home *** CD-ROM | disk | FTP | other *** search
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of shell archive."
- # Contents: Makefile Readme.goban goban.c goban.h goban.icon goboard.c
- # gocapture.c gocircle.c gomaster.c gopanel.c goprint.c goservice.c
- # masterofgo masterofgo.brd
- # Wrapped by mariano@poincare on Fri Sep 6 15:07:03 1991
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'Makefile' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Makefile'\"
- else
- echo shar: Extracting \"'Makefile'\" \(484 characters\)
- sed "s/^X//" >'Makefile' <<'END_OF_FILE'
- X#
- X# @(#)Makefile.src.release 1.5 87/10/19 SMI
- X#
- X
- X
- XGOBANSRC= goban.c goboard.c gopanel.c goservice.c gocapture.c gocircle.c \
- X goprint.c gomaster.c
- XGOBANOBJ= goban.o goboard.o gopanel.o goservice.o gocapture.o gocircle.o \
- X goprint.o gomaster.o
- X
- XWINLIBS=-lsuntool -lsunwindow -lpixrect
- X
- XFLOATFLAG= -fsingle -fswitch
- XCFLAGS = -O $(FLOATFLAG)
- X
- Xall: goban
- X
- Xgoban: ${GOBANOBJ}
- X cc -o goban ${CFLAGS} ${GOBANOBJ} ${WINLIBS}
- X
- X${GOBANOBJ}: goban.icon goban.h
- X cc -c ${CFLAGS} $*.c
- X
- END_OF_FILE
- if test 484 -ne `wc -c <'Makefile'`; then
- echo shar: \"'Makefile'\" unpacked with wrong size!
- fi
- # end of 'Makefile'
- fi
- if test -f 'Readme.goban' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'Readme.goban'\"
- else
- echo shar: Extracting \"'Readme.goban'\" \(5419 characters\)
- sed "s/^X//" >'Readme.goban' <<'END_OF_FILE'
- Xgoban [name]
- X
- XFeatures
- X - save and restore games.
- X - step forwards and backwards in moves of a game.
- X - automatic capture of stones.
- X - detects ko violations and suicide moves (illegal).
- X - laserwriter output for board diagrams.
- X - confirmation required for irrevocable actions
- X - dynamic resizing of tool window
- X - automatic handicap placement for 19 x 19 board (up to
- X 17 stones).
- X - can start games with placed stones for go problems.
- X - default game from "Master of Go" by Kawabata.
- X
- XDescription
- X
- XGoban is Japanese for "go board". It is an automatic board, but
- Xdoes not play go. If you invoke it with no arguments it will
- Xinitialize itself with the game described in the book "The
- XMaster of Go", by Yasunari Kawabata, winner of the Nobel Prize
- Xfor Literature. If you give it an argument, it will use that as
- Xa base to construct names for files of which there are two
- X(assume "name" is the argument): "name.game" and "name.brd".
- X"name.game" is read and written by goban, and is the record of
- Xthe game, including handicaps and initial positions of stones
- X(for go problems). "name.brd" is written only and is an ascii
- Xrepresentation of the board and the moves, suitable for
- Xelectronic mailing.
- X
- XThere are four windows. The two wide ones at the top of the
- Xtool are for messages. The lower part of goban consists of a
- Xboard diagram and a control panel.
- X
- XThe top window explains what actions the mouse buttons perform
- Xat a given moment. When confirmation of a command is required
- Xthe message will say "Confirm: right mouse button. Deny: Left
- Xand center buttons." The second window displays the number of
- Xcaptured stones.
- X
- XStones are placed on the board by selecting the grid point with
- Xthe cursor and pressing the left button. In the control panel
- Xthe color of the stone of the player to play next ("Next:") will
- Xchange. If the center button is pressed in the board area,
- Xgoban will backup a move (undo it). The right button causes
- Xgoban to move forward in the game. Stepping backwards and
- Xforwards will not alter the game until the left button is
- Xpressed to place a stone. Then any moves beyond the current
- Xposition will be discarded.
- X
- XThe control panel provides the following controls:
- X
- XMoving (Placing): Pressing this button changes the state from
- Xmaking moves to placing stones or vice versa. The current state
- Xis indicated. If stones are being "placed" then the color of
- Xthe next stone to be placed will not change unless the stone
- Xbeside the label "Next:" (or the label) is hit with the left
- Xmouse button. Placing stones should be done only after a
- X"Reset" has been issued (see "Reset") (but this is not
- Xenforced).
- X
- XPass: The "pass" move is made (no stone is placed) and it is
- Xthe next player's turn.
- X
- XReplay: Redraws the board.
- X
- XClose: Closes goban to iconic state.
- X
- XQuit: Exit the goban program. Must be confirmed with right mouse
- Xbutton.
- X
- XReset: Reset the state of the game to it's initial state which
- Xis that no moves have been made, but the handicap stones are on
- Xthe board. (See "Handicap"). Must be confirmed with right
- Xmouse button.
- X
- XCurrent Move (Slider): Replay the game to the move number
- Xcontrolled by the slider when the mouse button is released.
- X
- XHandicap (Slider): Control the number of handicap stones that
- Xwill be automatically placed if "Reset" is issued.
- X
- XGame: Type in and change the name that is used to form the file
- Xnames used to save the game record and the ascii board
- Xrepresentation. ("name.game" and "name.brd").
- X
- XRead Game: Read in a new game record (if the "Game:" name has
- Xbeen changed) or reread the current game record from
- X"name.game". Must be confirmed with right mouse button.
- X
- XPrint: Goban will send PostScript commands to the printer in
- Xthe system that goes by the tag "Plw" (normally the default Sun
- Xlaser writer). A diagram of the board will be printed.
- X
- XWrite Game: Write the current state of the game to "name.game"
- Xwhere "name" is the value of the "Game:" panel button. Must be
- Xconfirmed with right mouse button.
- X
- XWrite Board: Write an ascii representation of the board and the
- Xmoves to "name.brd" where "name" is the value of the "Game:"
- Xpanel button. Must be confirmed with right mouse button.
- X
- X
- X
- XSample ".game" File (19x19 board, no handicap)
- X
- X19
- X0
- X .
- X .
- XBlack
- X D3 Q16
- X R4 C16
- X C10 Q3
- X R3 M3
- X K16 G16
- X N16 R10
- X R8 C6
- X C7 C3
- X C4 E3
- X B3
- X
- X
- XSample ".brd" File (19x19 board, no handicap)
- X
- X A B C D E F G H J K L M N O P Q R S T
- X19 . . . . . . . . . . . . . . . . . . . 19
- X18 . . . . . . . . . . . . . . . . . . . 18
- X17 . . . . . . . . . . . . . . . . . . . 17
- X16 . . O . . . O . . * . . * . . O . . . 16
- X15 . . . . . . . . . . . . . . . . . . . 15
- X14 . . . . . . . . . . . . . . . . . . . 14
- X13 . . . . . . . . . . . . . . . . . . . 13
- X12 . . . . . . . . . . . . . . . . . . . 12
- X11 . . . . . . . . . . . . . . . . . . . 11
- X10 . . * . . . . . . . . . . . . . O . . 10
- X 9 . . . . . . . . . . . . . . . . . . . 9
- X 8 . . . . . . . . . . . . . . . . * . . 8
- X 7 . . * . . . . . . . . . . . . . . . . 7
- X 6 . . O . . . . . . . . . . . . . . . . 6
- X 5 . . . . . . . . . . . . . . . . . . . 5
- X 4 . . * . . . . . . . . . . . . . * . . 4
- X 3 . * O * O . . . . . . O . . . O * . . 3
- X 2 . . . . . . . . . . . . . . . . . . . 2
- X 1 . . . . . . . . . . . . . . . . . . . 1
- X A B C D E F G H J K L M N O P Q R S T
- X 1: D3 Q16.
- X 3: R4 C16.
- X 5: C10 Q3.
- X 7: R3 M3.
- X 9: K16 G16.
- X 11: N16 R10.
- X 13: R8 C6.
- X 15: C7 C3.
- X 17: C4 E3.
- X 19: B3
- X
- END_OF_FILE
- if test 5419 -ne `wc -c <'Readme.goban'`; then
- echo shar: \"'Readme.goban'\" unpacked with wrong size!
- fi
- # end of 'Readme.goban'
- fi
- if test -f 'goban.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'goban.c'\"
- else
- echo shar: Extracting \"'goban.c'\" \(8350 characters\)
- sed "s/^X//" >'goban.c' <<'END_OF_FILE'
- X#ifndef lint
- Xstatic char sccsid[]= "@(#)goban.c 1.3 87/01/11 Copyr 1986 Sun Micro";
- X#endif
- X
- X/* Copyright (c) Sun MicroSystems, 1986. This code may be used and modified
- X for not-for-profit use. This notice must be retained. */
- X
- X#include "goban.h"
- X#include <suntool/panel.h>
- X#include <suntool/canvas.h>
- X#include <suntool/textsw.h>
- X
- X
- Xstatic short IconBits [] = {
- X#include "goban.icon"
- X};
- XDEFINE_ICON_FROM_IMAGE (GobanIcon, IconBits);
- X
- X
- Xint RootFD;
- XFrame GoFrame;
- XCanvas BoardSW;
- XPixwin *BoardPW;
- Xstruct pixrect *BlackStone, *WhiteStone, *BlackFirstImage, *WhiteFirstImage;
- Xstruct pixfont *Font, *Fonts [4];
- XPanel MainPanel;
- XPanel MsgSW, StatusSW;
- XPanel_item CurrMoveSlider, HandicapSlider, FirstPlayerButton;
- XPanel_item PlaceMoveButton, NameButton, LabelButton;
- XPanel_item MsgPanelItem, StatusPanelItem;
- XTextsw TextSW;
- Xint (*CachedTextSWProc) ();
- Xint UserTextMods, Verbose;
- X
- Xint RemBSWWidth, RemBSWHeight;
- Xint Radius;
- Xint LineWidth;
- Xint DebugLevel;
- Xint Checked [MaxGrid] [MaxGrid]; /* Initialized to zero. */
- Xint CheckNum; /* Initialized to 1. */
- X
- Xchar GameName [80] = " ";
- X
- X
- X/* Forward declarations. */
- XBSWEventProc ();
- XBSWRepaintProc ();
- XBSWResizeProc ();
- XMoveType *IsAltOfNextMove ();
- XTextSWProc ();
- X
- Xextern SigPipe ();
- X
- X
- Xmain (argc, argv)
- X int argc;
- X char *argv [];
- X{
- XGameType *Game;
- Xint i, j;
- X for (i= 0; i < MaxGrid; i++)
- X for (j= 0; j < MaxGrid; j++)
- X Checked [i][j]= 0;
- X CheckNum= 1;
- X Game= Malloc (GameType);
- X Hello (&argc, argv, Game);
- X if (GameName [0] == ' ') {
- X DfltGame (GameName, Game, PANEL_CLEAR);
- X } else {
- X if (ReadGame (GameName, Game, PANEL_CLEAR)) {
- X fprintf (stderr, "Unable to read \"%s\".\n", GameName);
- X ZeroGame (Game, PANEL_CLEAR);
- X HandicapBoard (Game);
- X }
- X }
- X window_main_loop (GoFrame);
- X} /* main */
- X
- X
- XBSWEventProc (canvas, event)
- X Canvas canvas;
- X Event *event;
- X{
- Xint i, j, k;
- XGameType *Game;
- XMoveType *Move;
- X if (event_is_up (event)) return;
- X Game= (GameType *) window_get (BoardSW, WIN_CLIENT_DATA);
- X if (UserTextMods) SaveText (Game);
- X switch (event_id (event)) {
- X case '\003':
- X exit (0); break;
- X case MS_LEFT:
- X i= (event_x (event) - 5 - 4 * Radius) / (2 * Radius);
- X j= Game->Grid - 1 - (event_y (event) - 5 - 4 * Radius) / (2 * Radius);
- X if (event_ctrl_is_down (event))
- X EnterMove (i, j, Game, 1, MoveAction);
- X else if (Move= IsAltOfNextMove (Game->CurrMove, i, j)) {
- X if (Game->CurrMove->Next != Move) {
- X PanelToLabel (Game->CurrMove->Next);
- X Game->CurrMove->Next= Move;
- X for (k= Game->MoveNum; Move->Next != NULL; Move= Move->Next)
- X k++;
- X panel_set (CurrMoveSlider, PANEL_MAX_VALUE, k, 0);
- X LabelToPanel (Game->CurrMove->Next);
- X }
- X Step (Game, 1);
- X } else EnterMove (i, j, Game, 1, AltMoveAction);
- X break;
- X case MS_MIDDLE:
- X if (Game->Placing) {
- X i= (event_x (event) - 5 - 4 * Radius) / (2 * Radius);
- X j= Game->Grid - 1 - (event_y(event) - 5 - 4 * Radius) / (2*Radius);
- X Game->Board [i][j]= Game->InitialBoard [i][j]= Empty;
- X DrawEmpty (Game, i, j);
- X } else
- X Backup (Game, 1);
- X break;
- X case MS_RIGHT:
- X if (event_ctrl_is_down (event)) Sideways (Game, 1);
- X else Step (Game, 1);
- X break;
- X }
- X} /* BSWEventProc */
- X
- X
- XBSWRepaintProc (canvas, pw, RepaintRects)
- X Canvas canvas;
- X Pixwin *pw;
- X Rectlist RepaintRects;
- X{
- XGameType *Game;
- Xint Width, Height;
- X Width= (int) window_get (canvas, CANVAS_WIDTH);
- X Height= (int) window_get (canvas, CANVAS_HEIGHT);
- X Game= (GameType *) window_get (BoardSW, WIN_CLIENT_DATA);
- X pw_writebackground (BoardPW, 0, 0, Width, Height, PIX_CLR);
- X DrawGame (Game, 1);
- X} /* BSWRepaintProc */
- X
- X
- XBSWResizeProc (canvas, Width, Height)
- X Canvas canvas;
- X int Width, Height;
- X{
- Xstruct rect *r;
- XGameType *Game= (GameType *) window_get (BoardSW, WIN_CLIENT_DATA);
- X DrawGameInit (Game, Width, Height);
- X} /* BSWResizeProc */
- X
- X
- XHello (argc, argv, Game)
- X int *argc;
- X char *argv [];
- X GameType *Game;
- X{
- Xchar FrameName [80];
- Xchar *c, *g;
- X Verbose= 1;
- X strncpy (FrameName, argv [0], 75);
- X strcat (FrameName, ".3.2");
- X GoFrame= window_create (NULL, FRAME,
- X FRAME_ICON, &GobanIcon,
- X FRAME_ARGC_PTR_ARGV, argc, argv,
- X FRAME_LABEL, FrameName,
- X WIN_HEIGHT, 900,
- X WIN_Y, 0,
- X 0);
- X while (--(*argc) > 0) {
- X if ('-' == (*++argv) [0]) {
- X switch ((*argv) [1]) {
- X case 'd':
- X c= &((*argv) [2]);
- X if (*c == '\0') {
- X --(*argc);
- X c= &((*++argv) [0]);
- X }
- X DebugLevel= atoi (c);
- X break;
- X case 'g':
- X break;
- X } /* switch */
- X } else {
- X c= &((*argv) [0]);
- X g= GameName;
- X do {
- X *g++= *c;
- X } while (*c++ != '\0');
- X } /* else */
- X } /* while */
- X Font= pw_pfsysopen ();
- X InitSW (GoFrame, Game);
- X Fonts [0]= pf_open ("/usr/lib/fonts/fixedwidthfonts/screen.r.7");
- X if (Fonts [0] == NULL)
- X fprintf (stderr
- X , "Can't open \"/usr/lib/fonts/fixedwidthfonts/screen.r.7\".\n");
- X Fonts [1]= pf_open ("/usr/lib/fonts/fixedwidthfonts/screen.r.11");
- X if (Fonts [1] == NULL)
- X fprintf (stderr
- X , "Can't open \"/usr/lib/fonts/fixedwidthfonts/screen.r.11\".\n");
- X Fonts [2]= pf_open ("/usr/lib/fonts/fixedwidthfonts/screen.r.14");
- X if (Fonts [2] == NULL)
- X fprintf (stderr
- X , "Can't open \"/usr/lib/fonts/fixedwidthfonts/screen.r.14\".\n");
- X Fonts [3]= pf_open ("/usr/lib/fonts/fixedwidthfonts/gallant.r.19");
- X if (Fonts [3] == NULL)
- X fprintf (stderr
- X , "Can't open \"/usr/lib/fonts/fixedwidthfonts/gallant.r.19\".\n");
- X RootFD= (int) window_get (GoFrame, WIN_FD);
- X signal (SIGPIPE, SigPipe);
- X} /* Hello */
- X
- X
- XInitSW (GoFrame, Game)
- X Frame GoFrame;
- X GameType *Game;
- X/* Initialize board subwindow. */
- X{
- Xstruct inputmask Mask;
- Xint Width; /* Assume square. */
- X MsgSW= (Panel) window_create (GoFrame, PANEL,
- X WIN_HEIGHT, MsgSWHeight,
- X 0);
- X StatusSW= (Panel) window_create (GoFrame, PANEL,
- X WIN_HEIGHT, StatusSWHeight,
- X 0);
- X MainPanel= window_create (GoFrame, PANEL, 0);
- X InitPanel (Game, GameName, MsgSW, StatusSW);
- X window_fit (MainPanel);
- X Width= ((struct rect *) window_get (GoFrame, FRAME_OPEN_RECT))->r_width;
- X BoardSW= window_create (GoFrame, CANVAS,
- X WIN_WIDTH, Width - 10,
- X WIN_HEIGHT, Width - 10,
- X CANVAS_WIDTH, Width - 10,
- X CANVAS_HEIGHT, Width - 10,
- X WIN_BELOW, MainPanel,
- X WIN_X, 0,
- X WIN_CLIENT_DATA, Game,
- X WIN_EVENT_PROC, BSWEventProc,
- X WIN_CONSUME_PICK_EVENTS, WIN_NO_EVENTS, WIN_MOUSE_BUTTONS, 0,
- X WIN_CONSUME_KBD_EVENTS, WIN_NO_EVENTS, WIN_ASCII_EVENTS, 0,
- X CANVAS_RESIZE_PROC, BSWResizeProc,
- X CANVAS_REPAINT_PROC, BSWRepaintProc,
- X CANVAS_RETAINED, FALSE,
- X CANVAS_FIXED_IMAGE, FALSE,
- X 0);
- X if (BoardSW == NULL)
- X Cafard ("Couldn't create BSW subwindow");
- X BoardPW = (Pixwin *) window_get (BoardSW, WIN_PIXWIN);
- X if (BoardPW == (struct pixwin *) NULL)
- X Cafard ("Couldn't create BSW pixwin");
- X TextSW= window_create (GoFrame, TEXTSW,
- X WIN_BELOW, BoardSW,
- X WIN_X, 0,
- X 0);
- X CachedTextSWProc= (int (*) ()) window_get (TextSW, TEXTSW_NOTIFY_PROC);
- X window_set (TextSW, TEXTSW_NOTIFY_PROC, TextSWProc, 0);
- X window_set (TextSW, TEXTSW_NOTIFY_LEVEL
- X , TEXTSW_NOTIFY_STANDARD | TEXTSW_NOTIFY_EDIT, 0);
- X} /* InitSW */
- X
- X
- X MoveType *
- XIsAltOfNextMove (m, i, j)
- X MoveType *m;
- X int i, j;
- X{
- XMoveType *m1;
- X if (m == NULL) return 0;
- X for (m1= m->Next; m1 != NULL; ) {
- X if ((m1->i == i) && (m1->j == j)) return m1;
- X m1= m1->AltNext;
- X if (m1 == m->Next) return 0;
- X }
- X return 0;
- X} /* IsAltOfNextMove */
- X
- X
- XSaveText (Game)
- X GameType *Game;
- X{
- X if (Game != NULL) {
- X if (Game->CurrMove == NULL) {
- X TextSWToData (&(Game->Note));
- X } else {
- X TextSWToData (&(Game->CurrMove->Note));
- X }
- X UserTextMods= 0;
- X }
- X} /* SaveText */
- X
- X
- XTextSWProc (textsw, attributes)
- X Textsw textsw;
- X Attr_avlist attributes;
- X{
- XAttr_avlist attrs;
- X for (attrs= attributes; *attrs; attrs= attr_next (attrs)) {
- X UserTextMods++;
- X }
- X CachedTextSWProc (textsw, attributes);
- X} /* TextSWProc */
- X
- X
- XTextSWToData (StringPtrPtr)
- X char **StringPtrPtr;
- X{
- Xchar *s;
- Xint Length;
- X if (*StringPtrPtr != NULL) {
- X free (*StringPtrPtr);
- X *StringPtrPtr= NULL;
- X }
- X Length= (int) window_get (TextSW, TEXTSW_LENGTH);
- X if (Length != 0) {
- X s= *StringPtrPtr= (char *) malloc (Length);
- X window_get (TextSW, TEXTSW_CONTENTS, 0, s, Length - 1);
- X /* Ignore added last newline character. */
- X s [Length - 1]= '\0';
- X }
- X} /* TextSWToData */
- END_OF_FILE
- if test 8350 -ne `wc -c <'goban.c'`; then
- echo shar: \"'goban.c'\" unpacked with wrong size!
- fi
- # end of 'goban.c'
- fi
- if test -f 'goban.h' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'goban.h'\"
- else
- echo shar: Extracting \"'goban.h'\" \(2583 characters\)
- sed "s/^X//" >'goban.h' <<'END_OF_FILE'
- X/* @(#)goban.h 1.3 87/01/11 Copyr 1986 Sun Micro
- X Copyright (c) Sun MicroSystems, 1986. This code may be used and modified
- X for not-for-profit use. This notice must be retained. */
- X
- X#include <suntool/sunview.h>
- X#include <stdio.h>
- X#include <sys/file.h>
- X
- X#define Black 0
- X#define White 1
- X /* White == !Black. */
- X#define Empty 2
- X
- X/* Actions */
- X#define MoveAction 1
- X#define PassAction 2
- X#define AltMoveAction 3
- X
- X#define NoDir 0
- X#define North (1 << 1)
- X#define East (1 << 2)
- X#define South (1 << 3)
- X#define West (1 << 4)
- X
- X#define MsgSWHeight 25
- X#define StatusSWHeight 25
- X
- X#define MaxGrid 21
- X#define MaxHandicap 17
- X#define MaxMoves ((MaxGrid * MaxGrid * 3) / 2)
- X#define MaxTitleChars 40
- X#define MaxMvLblChars 2
- X
- X#define Malloc(a) (a *) malloc (sizeof (a))
- X
- Xtypedef short Stone;
- X
- Xtypedef struct MoveType {
- X char i, j; /* i == -1 means pass. */
- X struct CaptureType *Captures;
- X struct MoveType *Next, *Prev, *AltNext, *AltPrev;
- X char *Note;
- X char Label [MaxMvLblChars];
- X} MoveType;
- X
- Xtypedef struct CaptureType {
- X unsigned char i, j;
- X struct CaptureType *Next;
- X} CaptureType;
- X
- Xtypedef struct GroupType {
- X short Color;
- X short NumLibs;
- X short NumStones;
- X struct GroupType *Next; /* for Trash list only. */
- X} GroupType;
- X
- Xtypedef struct GameType {
- X char Title [40]; /* keyword of filenames Title.brd and Title.game. */
- X char *Note;
- X Stone Board [MaxGrid] [MaxGrid];
- X Stone InitialBoard [MaxGrid] [MaxGrid];
- X GroupType *Groups [MaxGrid] [MaxGrid];
- X MoveType *MoveList, *CurrMove;
- X short NumMoves; /* Gets set to MoveNum if player changes play.*/
- X short MoveNum; /* Initially NumMoves. */
- X short Handicap;
- X short Prisoners [2]; /* Prisoner stones colored with given color. */
- X Stone FirstPlayer; /* Black or White. */
- X short Placing; /* 1 if user placing stones (not yet moving)*/
- X short Grid;
- X /* Size of board: 9 (neophyte), 13 (novice), 17 (historical),
- X 19 (standard), 21 (experimental). */
- X} GameType;
- X
- Xextern MoveType *TrashMoves;
- Xextern CaptureType *TrashCaptures;
- Xextern GroupType *TrashGroups;
- X
- Xextern struct screen Screen;
- Xextern int RootFD;
- Xextern Frame GoFrame;
- Xextern Pixwin *BoardPW;
- Xextern struct pixrect *BlackStone, *WhiteStone;
- Xextern struct pixrect *BlackFirstImage, *WhiteFirstImage;
- Xextern struct pixfont *Font, *Fonts [4];
- X
- Xextern int RemBSWWidth, RemBSWHeight;
- Xextern int Radius, LineWidth;
- Xextern int DebugLevel;
- Xextern int Checked [MaxGrid][MaxGrid];
- Xextern int CheckNum;
- X
- Xextern MoveType *AllocMove ();
- Xextern CaptureType *AllocCapture ();
- Xextern GroupType *AllocGroup ();
- END_OF_FILE
- if test 2583 -ne `wc -c <'goban.h'`; then
- echo shar: \"'goban.h'\" unpacked with wrong size!
- fi
- # end of 'goban.h'
- fi
- if test -f 'goban.icon' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'goban.icon'\"
- else
- echo shar: Extracting \"'goban.icon'\" \(1933 characters\)
- sed "s/^X//" >'goban.icon' <<'END_OF_FILE'
- X/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16
- X */
- X 0xF888,0x8C8A,0x8988,0x88CF,0xF22A,0x2622,0x27E2,0xA26E,
- X 0xF44C,0x4446,0x4FE4,0xC44F,0xF119,0x1513,0x1FF1,0x915B,
- X 0xF888,0x8C8A,0x9FF8,0x88CF,0xFFFF,0xFFFF,0xFFFF,0xFFEE,
- X 0xF44C,0x4446,0x5FF4,0xC44F,0xF119,0x1513,0x1FF1,0x915B,
- X 0xF888,0x8C8A,0x8FE8,0x88CF,0xF22A,0x2622,0x27E2,0xA26E,
- X 0xF44C,0x4446,0x47C4,0xC44F,0xF119,0x1512,0x1FF1,0x915B,
- X 0xF888,0x8C87,0x1FF8,0x88CF,0xF22A,0x262F,0xBFF2,0xA26E,
- X 0xFFFF,0xFFFF,0xFFFF,0xFFCF,0xF119,0x150F,0x9FF1,0x915B,
- X 0xF888,0x8C87,0x1FF8,0x88CF,0xF22A,0x2622,0x2FE2,0xA26E,
- X 0xF44C,0x4446,0x47C4,0xC44F,0xF119,0x1F1F,0x97D3,0xF15B,
- X 0xF888,0xBF9F,0xCC6E,0x38CF,0xF22A,0x7FFF,0xF83C,0x1A6E,
- X 0xF44C,0x7FFF,0xF018,0x0C4F,0xFFFF,0xFFFF,0xF018,0x0FDB,
- X 0xF888,0xFFFF,0xF018,0x08CF,0xF22A,0x7FFF,0xF83C,0x1A6E,
- X 0xF44C,0x7FFF,0xEC66,0x344F,0xF119,0x1F1F,0xD7D3,0xF15B,
- X 0xF888,0x8C8F,0x8988,0x88CF,0xF22A,0x2638,0xE322,0xA26E,
- X 0xF44C,0x4470,0x6544,0xC44F,0xF119,0x1520,0x3111,0x915B,
- X 0xFFFF,0xFFE0,0x3FFF,0xFFCF,0xF22A,0x2620,0x2322,0xA26E,
- X 0xF44C,0x4470,0x6544,0xC44F,0xF119,0x1518,0xD111,0x915B,
- X 0xF888,0x8C8F,0x8988,0x88CF,0xF22A,0x2622,0x2322,0xA26E,
- X 0xF44C,0x4446,0x4544,0xC44F,0xF119,0x1513,0x1111,0x915B,
- X 0xF888,0x8C8A,0x8988,0x88CF,0xFFFF,0xFFFF,0xFFFF,0xFFEE,
- X 0xF444,0x4444,0x4444,0x444F,0xF111,0x1111,0x1111,0x111B,
- X 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFEEE,0xEEEE,0xEEEE,0xEEEE,
- X 0xF7FF,0xFFFF,0xFFFF,0xFFFF,0xF3BB,0xBBBB,0xBBBB,0xBBBB,
- X 0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
- X 0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
- X 0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
- X 0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
- X 0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
- X 0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
- X 0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001,
- X 0x8000,0x0000,0x0000,0x0001,0xFFFF,0xFFFF,0xFFFF,0xFFFF
- END_OF_FILE
- if test 1933 -ne `wc -c <'goban.icon'`; then
- echo shar: \"'goban.icon'\" unpacked with wrong size!
- fi
- # end of 'goban.icon'
- fi
- if test -f 'goboard.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'goboard.c'\"
- else
- echo shar: Extracting \"'goboard.c'\" \(15937 characters\)
- sed "s/^X//" >'goboard.c' <<'END_OF_FILE'
- X#ifndef lint
- Xstatic char sccsid[]= "@(#)goboard.c 1.3 87/01/11 Copyr 1986 Sun Micro";
- X#endif
- X
- X/* Copyright (c) Sun MicroSystems, 1986. This code may be used and modified
- X for not-for-profit use. This notice must be retained. */
- X
- X#include "goban.h"
- X#include <suntool/canvas.h>
- X#include <suntool/panel.h>
- X#include <suntool/textsw.h>
- X
- X
- X#define GridX(i) (5 + Radius + ((i) + 2) * 2 * Radius)
- X#define GridY(j) (5 + Radius + (Game->Grid - (j) - 1 + 2) * 2 * Radius)
- X
- X#define DrawBlack(i,j,r) \
- X pw_rop (BoardPW, GridX (i) - r, GridY (j) - r \
- X , 2 * r + 1, 2 * r + 1, PIX_SRC, BlackStone, 0,0)
- X#define DrawWhite(i,j,r) \
- X pw_rop (BoardPW, GridX (i) - r, GridY (j) - r \
- X , 2 * r + 1, 2 * r + 1, PIX_SRC, WhiteStone, 0,0)
- X
- Xextern Canvas BoardSW;
- Xextern Panel_item CurrMoveSlider, LabelButton;
- Xextern Textsw TextSW;
- Xextern int UserTextMods, Verbose;
- X
- X
- XBackup (Game, Draw)
- X GameType *Game;
- X int Draw;
- X{
- Xint i, j;
- XStone s; /* Other player. */
- Xchar *String;
- XCaptureType *Cap;
- X if (Game->Placing) return;
- X if (Game->MoveNum <= 0) return;
- X if (Game->CurrMove == NULL) return;
- X if (Draw && Game->CurrMove) PanelToLabel (Game->CurrMove->Next);
- X Game->MoveNum--;
- X i= Game->CurrMove->i;
- X j= Game->CurrMove->j;
- X if (Draw) {
- X if (i >= 0) DrawEmpty (Game, i, j);
- X if (Game->CurrMove->Next)
- X DrawAltsEmpty (Game, Game->CurrMove);
- X }
- X if (i >= 0) RemoveStone (Game, i, j);
- X if (Game->MoveNum & 1) s= Game->FirstPlayer;
- X else s= !Game->FirstPlayer;
- X if (Draw) SetFirstPlayerButton (!s, PANEL_CLEAR);
- X for (Cap= Game->CurrMove->Captures; Cap != NULL; Cap= Cap->Next) {
- X Game->Board [Cap->i] [Cap->j]= s;
- X Game->Prisoners [s]--;
- X NewStoneToGroups (Game, (int) Cap->i, (int) Cap->j);
- X if (Draw) DrawMove (Game, NULL, Cap->i, Cap->j);
- X }
- X Game->CurrMove= Game->CurrMove->Prev;
- X if (Draw) {
- X Status (Game);
- X StdMsg ();
- X if (Game->CurrMove) {
- X if (Verbose)
- X HighlightMove (Game, Game->CurrMove, -1, -1);
- X if (Game->CurrMove->Next)
- X DrawAlts (Game, Game->CurrMove);
- X NewText (Game->CurrMove->Note);
- X LabelToPanel (Game->CurrMove->Next);
- X } else {
- X NewText (Game->Note);
- X }
- X }
- X if (DebugLevel == 1) DebugGroups (Game->Groups);
- X} /* Backup */
- X
- X
- XDrawAlpha (Game, i, j, c)
- X GameType *Game;
- X int i, j;
- X char *c;
- X{
- X pw_text (BoardPW, GridX (i) - Radius / 2 + 1
- X , GridY (j) + Radius / 2
- X , PIX_SRC, Font, c);
- X} /* DrawAlpha */
- X
- X
- XDrawAlts (Game, Move)
- X GameType *Game;
- X MoveType *Move;
- X{
- XMoveType *m;
- X if (!Verbose) return;
- X for (m= Move->Next; m != NULL; ) {
- X pw_rop (BoardPW, GridX (m->i) - Radius / 2
- X , GridY (m->j) - Radius / 2
- X , Radius, Radius, PIX_SRC | PIX_COLOR (0), NULL, 0, 0);
- X if (m->Label [0] != '\0') DrawAlpha (Game, m->i, m->j, m->Label);
- X m= m->AltNext;
- X if (m == Move->Next) break;
- X }
- X} /* DrawAlts */
- X
- X
- XDrawAltsEmpty (Game, Move)
- X GameType *Game;
- X MoveType *Move;
- X{
- XMoveType *m;
- X for (m= Move->Next; ; ) {
- X DrawEmpty (Game, m->i, m->j);
- X m= m->AltNext;
- X if (m == Move->Next) break;
- X }
- X} /* DrawAltsEmpty */
- X
- X
- XDrawEmpty (Game, i, j)
- X GameType *Game;
- X int i, j;
- X{
- X pw_rop (BoardPW, GridX (i) - Radius
- X , GridY (j) - Radius, 2 * Radius + 1, 2 * Radius + 1
- X , PIX_SRC | PIX_COLOR (0), NULL, 0, 0);
- X if (i > 0)
- X pw_rop (BoardPW, GridX (i) - Radius, GridY (j) - 1
- X , Radius + 1, LineWidth, PIX_SRC | PIX_COLOR (1), NULL, 0, 0);
- X if (i < (Game->Grid - 1))
- X pw_rop (BoardPW, GridX (i), GridY (j) - 1
- X , Radius + 1, LineWidth, PIX_SRC | PIX_COLOR (1), NULL, 0, 0);
- X if (j > 0)
- X pw_rop (BoardPW, GridX (i) - 1, GridY (j)
- X , LineWidth, Radius + 1, PIX_SRC | PIX_COLOR (1), NULL, 0, 0);
- X if (j < (Game->Grid - 1))
- X pw_rop (BoardPW, GridX (i) - 1, GridY (j) - Radius
- X , LineWidth, Radius + 1, PIX_SRC | PIX_COLOR (1), NULL, 0, 0);
- X if (((i == 3) || (i == Game->Grid / 2) || (i == Game->Grid - 4))
- X && ((j == 3) || (j == Game->Grid / 2) || (j == Game->Grid - 4)))
- X Disk (BoardPW, 2 * LineWidth, GridX (i), GridY (j), 1);
- X} /* DrawEmpty */
- X
- X
- XDrawGame (Game, ReCompBoard)
- X GameType *Game;
- X{
- Xint i, j, k;
- XMoveType *Move;
- XCaptureType *c;
- XStone s;
- Xchar String [3];
- X for (i= 0; i < Game->Grid; i++) { /* Draw horizontals, then verticals. */
- X pw_rop (BoardPW, GridX (i) - 1, GridX (0) - 1
- X , LineWidth, (Game->Grid-1) * 2 * Radius
- X , PIX_SRC | PIX_COLOR (1), NULL, 0, 0);
- X sprintf (String, "%c", (i < 8) ? ('A' + i) : ('B' + i));
- X pw_text (BoardPW, GridX (i) -1, GridX (-1) - 10, PIX_SRC, Font, String);
- X pw_text (BoardPW, GridX (i) -1, GridX (Game->Grid + 2) - 10, PIX_SRC
- X , Font, String);
- X sprintf (String, "%2d", i + 1);
- X pw_text (BoardPW, GridX (-1) - 20, GridY (i) +2, PIX_SRC, Font, String);
- X pw_text (BoardPW, GridX (Game->Grid + 2) - 20, GridY (i) +2, PIX_SRC
- X , Font, String);
- X pw_rop (BoardPW, GridX (0) - 1, GridX (i) - 1
- X , (Game->Grid-1) * 2 * Radius, LineWidth
- X , PIX_SRC | PIX_COLOR (1), NULL, 0, 0);
- X }
- X /* Draw 9 handicap points (seimoku). */
- X Disk (BoardPW, 2 * LineWidth, GridX (3), GridY (3), 1);
- X Disk (BoardPW, 2 * LineWidth, GridX (3), GridY (Game->Grid / 2), 1);
- X Disk (BoardPW, 2 * LineWidth, GridX (3), GridY (Game->Grid - 4), 1);
- X Disk (BoardPW, 2 * LineWidth, GridX (Game->Grid / 2), GridY (3), 1);
- X Disk (BoardPW, 2 * LineWidth, GridX (Game->Grid / 2)
- X , GridY (Game->Grid / 2), 1);
- X Disk (BoardPW, 2 * LineWidth, GridX (Game->Grid / 2)
- X , GridY (Game->Grid - 4), 1);
- X Disk (BoardPW, 2 * LineWidth, GridX (Game->Grid - 4), GridY (3), 1);
- X Disk (BoardPW, 2 * LineWidth, GridX (Game->Grid - 4)
- X , GridY (Game->Grid / 2), 1);
- X Disk (BoardPW, 2 * LineWidth, GridX (Game->Grid - 4)
- X , GridY (Game->Grid - 4), 1);
- X /* Place stones on board according to Initial position. */
- X for (i= 0; i < Game->Grid; i++) {
- X for (j= 0; j < Game->Grid; j++) {
- X if (Game->InitialBoard [i] [j] == Black) DrawBlack (i, j, Radius);
- X else if (Game->InitialBoard [i] [j] == White)
- X DrawWhite (i, j, Radius);
- X if (ReCompBoard) Game->Board [i] [j]= Game->InitialBoard [i] [j];
- X }
- X }
- X /* Place stones on board according to moves. */
- X if (ReCompBoard) {
- X s= Game->FirstPlayer;
- X NullGroups (Game);
- X Game->Prisoners [0]= Game->Prisoners [1]= 0;
- X }
- X for (k= 0, Move= Game->MoveList; (k < Game->MoveNum) && (Move!=NULL); k++){
- X i= Move->i;
- X j= Move->j;
- X if (ReCompBoard) {
- X if (i >= 0) {
- X Game->Board [i] [j]= s;
- X NewStoneToGroups (Game, i, j);
- X if (GenCaptures (Game, !s, Move)) {
- X for (c= Move->Captures; c != NULL; c= c->Next) {
- X DrawEmpty (Game, c->i, c->j);
- X }
- X }
- X }
- X s= !s;
- X }
- X if (i >= 0) {
- X if (Game->Board [i] [j] == Black) DrawBlack (i, j, Radius);
- X else DrawWhite (i, j, Radius);
- X }
- X Game->CurrMove= Move;
- X Move= Move->Next;
- X }
- X HighlightMove (Game, Game->CurrMove, -1, -1);
- X panel_set (CurrMoveSlider, PANEL_VALUE, Game->MoveNum, 0);
- X for ( ; Move != NULL; k++, Move= Move->Next);
- X /* Find last move of this path. */
- X panel_set (CurrMoveSlider, PANEL_MAX_VALUE, k, 0);
- X if (Game->CurrMove) {
- X LabelToPanel (Game->CurrMove->Next);
- X NewText (Game->CurrMove->Note);
- X if (Game->CurrMove->Next) DrawAlts (Game, Game->CurrMove);
- X } else {
- X NewText (Game->Note);
- X }
- X} /* DrawGame */
- X
- X
- XDrawGameInit (Game, Width, Height)
- X GameType *Game;
- X int Width, Height;
- X{
- X Radius= Width;
- X if (Height < Width) Radius= Height;
- X if (Radius > 650) {
- X LineWidth= 3;
- X Font= Fonts [3];
- X } else if (Radius > 400) {
- X LineWidth= 2;
- X Font= Fonts [2];
- X } else if (Radius > 300) {
- X LineWidth= 1;
- X Font= Fonts [1];
- X } else {
- X LineWidth= 1;
- X Font= Fonts [0];
- X }
- X Radius= Radius - 10;
- X Radius= Radius / (Game->Grid + 4);
- X Radius= Radius / 2;
- X if (BlackStone != NULL) pr_destroy (BlackStone);
- X if (WhiteStone != NULL) pr_destroy (WhiteStone);
- X BlackStone= mem_create (2 * Radius + 1, 2 * Radius + 1, 1);
- X WhiteStone= mem_create (2 * Radius + 1, 2 * Radius + 1, 1);
- X /* Create stone pixrects. */
- X DiskPR (BlackStone, Radius, Radius, Radius, 1);
- X DiskPR (WhiteStone, Radius, Radius, Radius, 1);
- X DiskPR (WhiteStone, Radius - LineWidth, Radius, Radius, 0);
- X} /* DrawGameInit */
- X
- X
- XDrawMove (Game, m, i, j)
- X GameType *Game;
- X MoveType *m;
- X int i, j;
- X{
- X/* Assume move is already on board. */
- X if (Game->Board [i] [j] == Black) DrawBlack (i, j, Radius);
- X else DrawWhite (i, j, Radius);
- X if (Verbose && m) HighlightMove (Game, m, -1, -1);
- X} /* DrawMove */
- X
- X
- XEnterMove (i, j, Game, Draw, Action)
- X int i, j;
- X GameType *Game;
- X int Draw, Action;
- X{
- Xint NumCaptures, Count;
- XMoveType *m, *m1;
- XStone s;
- XGroupType *Neighbors [4], *g;
- X if (Game->CurrMove != NULL) PanelToLabel (Game->CurrMove->Next);
- X if (Action == PassAction) {
- X i= -1;
- X j= -1;
- X } else {
- X if ((i < 0) || (i >= Game->Grid) || (j < 0) || (j >= Game->Grid))
- X return 1;
- X }
- X if (Game->Placing) {
- X if (Action != PassAction) {
- X Game->Board [i][j]= Game->InitialBoard [i][j]= Game->FirstPlayer;
- X DrawMove (Game, NULL, i, j);
- X return 0;
- X } else return 0;
- X }
- X if (Action != PassAction) {
- X if (Game->Board [i] [j] != Empty) return 1;
- X }
- X if (Game->MoveNum & 1) s= !Game->FirstPlayer;
- X else s= Game->FirstPlayer;
- X if (Action != PassAction) { /* Check legality of move */
- X g= AllocGroup (s, 0, 0);
- X CountGrpLibs (Game, i, j, s, g, 0);
- X if (g->NumLibs <= 0) {
- X NumCaptures= CheckCaptures (Game, !s, i, j);
- X if (FindFriends (i, j, Game, s, Neighbors) && (NumCaptures == 0)) {
- X /* Undo suicide. */
- X FreeGroup (g);
- X StatusMsg ("Illegal move (suicide).");
- X return 1;
- X } else { /* Detect ko or single suicide. */
- X if (NumCaptures == 0) {
- X /* Undo suicide. */
- X FreeGroup (g);
- X StatusMsg ("Illegal move (suicide).");
- X return 1;
- X } else if (NumCaptures == 1) { /* Check for ko violation. */
- X if ((Game->CurrMove != NULL)
- X && (Game->CurrMove->Captures != NULL)
- X && (Game->CurrMove->Captures->Next == NULL)
- X && (Game->CurrMove->Captures->i == i)
- X && (Game->CurrMove->Captures->j == j)) {
- X /* ko violation. */
- X FreeGroup (g);
- X StatusMsg ("Illegal move (ko violation).");
- X return 2;
- X }
- X }
- X }
- X }
- X FreeGroup (g);
- X }
- X if ((Game->MoveList == NULL) || (Action == MoveAction)
- X || (Action == PassAction)) {
- X /* Get rid of moves beyond current move. */
- X/* if (Game->NumMoves != Game->MoveNum) { */
- X if (Game->CurrMove != NULL) {
- X if (Draw && Verbose && Game->CurrMove->Next)
- X DrawEmpty (Game, Game->CurrMove->Next->i
- X , Game->CurrMove->Next->j);
- X FreeMoves (Game->CurrMove->Next);
- X Game->CurrMove->Next= NULL;
- X } else {
- X FreeMoves (Game->MoveList);
- X }
- X/* } */
- X m= AllocMove (i, j, Game->CurrMove);
- X if (Game->MoveList == NULL) Game->MoveList= m;
- X Game->NumMoves= Game->MoveNum + 1;
- X panel_set (CurrMoveSlider, PANEL_MAX_VALUE, Game->NumMoves
- X , PANEL_PAINT, PANEL_CLEAR, 0);
- X } else if (Action == AltMoveAction) {
- X#define NEW
- X#ifdef NEW
- X m1= Game->CurrMove->Next;
- X m= AllocMove (i, j, Game->CurrMove);
- X Game->NumMoves= Game->MoveNum + 1;
- X panel_set (CurrMoveSlider, PANEL_MAX_VALUE, Game->NumMoves
- X , PANEL_PAINT, PANEL_CLEAR, 0);
- X if (m1 != NULL) {
- X if ((m1->Label [0] == ' ') || (m1->Label [0] == 0))
- X m1->Label [0]= 'a';
- X m->AltNext= m1;
- X m->AltPrev= m1->AltPrev;
- X m1->AltPrev= m;
- X m->AltPrev->AltNext= m;
- X for (m1= m->AltNext, Count= 1; m1 != m; m1= m1->AltNext)
- X m1->Label [0]= 'a' + Count++;
- X m->Label [0]= 'a';
- X LabelToPanel (m); /* Step will PanelToLabel(Game->CurrMove->Next) */
- X }
- X#else
- X if (Game->CurrMove != NULL) {
- X if ((Game->CurrMove->Label [0] == ' ')
- X || (Game->CurrMove->Label [0] == 0))
- X Game->CurrMove->Label [0]= 'a';
- X LabelToPanel (Game->CurrMove->Next);
- X m= AllocMove (i, j, Game->CurrMove->Prev);
- X m->AltPrev= Game->CurrMove;
- X m->AltNext= Game->CurrMove->AltNext;
- X Game->CurrMove->AltNext= m;
- X m->AltNext->AltPrev= m;
- X if (Game->CurrMove->Prev == NULL) Game->MoveList= m;
- X else Game->CurrMove->Prev->Next= m;
- X for (m1= m->AltNext, Count= 0; m1 != m; m1= m1->AltNext) Count++;
- X m->Label [0]= 'a' + Count;
- X Backup (Game, Draw);
- X } else Cafard ("AltMoveAction: Game->CurrMove == NULL");
- X#endif
- X }
- X Step (Game, Draw);
- X return 0;
- X} /* EnterMove */
- X
- X
- XHighlightMove (Game, m, ii, jj)
- X GameType *Game;
- X MoveType *m;
- X int ii, jj;
- X/* If (m) use it for i and j; otherwise use ii and jj. */
- X{
- Xint i, j;
- Xint Color;
- X if (m) {
- X i= m->i;
- X j= m->j;
- X } else {
- X i= ii;
- X j= jj;
- X }
- X if (Game->Board [i][j] == Black) Color= 0; else Color= 1;
- X if (1 || m->Label [0] < 'a')
- X Disk (BoardPW, 2 * LineWidth, GridX (i), GridY (j), Color);
- X else
- X pw_text (BoardPW, GridX (i) - Radius / 2 + 1
- X , GridY (j) + Radius / 2
- X , PIX_SRC ^ PIX_DST, Font, m->Label);
- X} /* HighlightMove */
- X
- X
- XNewText (Msg)
- X char *Msg;
- X{
- Xchar Junk [3];
- X if (Msg == NULL) {
- X Junk [0]= '\n';
- X Junk [1]= '\n';
- X Junk [2]= '\0';
- X Msg= Junk;
- X }
- X textsw_replace (TextSW, 0, TEXTSW_INFINITY, Msg, strlen (Msg));
- X window_set (TextSW, TEXTSW_INSERTION_POINT, TEXTSW_INFINITY, 0);
- X textsw_insert (TextSW, "\n", 1);
- X window_set (TextSW, TEXTSW_INSERTION_POINT, 0, 0);
- X UserTextMods= 0;
- X if (Verbose) textsw_normalize_view (TextSW, 0);
- X else textsw_normalize_view (TextSW, TEXTSW_INFINITY);
- X/* textsw_display (TextSW);*/
- X} /* NewText */
- X
- X
- XReplay (Game, ReCompBoard)
- X GameType *Game;
- X int ReCompBoard;
- X{
- Xstruct rect *r;
- X r= (struct rect *) window_get (BoardSW, WIN_RECT);
- X pw_writebackground (BoardPW, 0, 0, r->r_width, r->r_height, PIX_CLR);
- X/*
- X DrawGameInit (Game, r->r_width, r->r_height);
- X*/
- X DrawGame (Game, ReCompBoard);
- X} /* Replay */
- X
- X
- XSetHandicap (Game, Value)
- X GameType *Game;
- X int Value;
- X/* Set handicap value and set first-player accordingly. */
- X{
- X if (Value < 2) Value= 0;
- X else if (Value > MaxHandicap) Value= MaxHandicap;
- X if (Value == 0) {
- X Game->Handicap= 0;
- X Game->FirstPlayer= Black;
- X } else {
- X Game->Handicap= Value;
- X Game->FirstPlayer= White;
- X }
- X} /* SetHandicap */
- X
- X
- XSideways (Game, Draw)
- X GameType *Game;
- X int Draw;
- X{
- XMoveType *m;
- X m= Game->CurrMove->AltNext;
- X if (Game->CurrMove->Prev != NULL) {
- X Backup (Game, Draw);
- X Game->CurrMove->Next= m;
- X Step (Game, Draw);
- X }
- X} /* Sideways */
- X
- X
- XStep (Game, Draw)
- X GameType *Game;
- X int Draw;
- X{
- Xint i, j;
- XStone s;
- XCaptureType *c;
- X if (Game->Placing) return;
- X if (Game->CurrMove == NULL) {
- X Game->MoveNum= 0;
- X if (Game->MoveList == NULL) return;
- X Game->CurrMove= Game->MoveList;
- X } else {
- X if (Draw) {
- X PanelToLabel (Game->CurrMove->Next);
- X if (Game->CurrMove->Next)
- X DrawAltsEmpty (Game, Game->CurrMove);
- X }
- X if (Game->CurrMove->Next == NULL) return;
- X Game->CurrMove= Game->CurrMove->Next;
- X }
- X Game->MoveNum++;
- X if (Game->MoveNum & 1) s= Game->FirstPlayer;
- X else s= !Game->FirstPlayer;
- X if (Draw) SetFirstPlayerButton (!s, PANEL_CLEAR);
- X i= Game->CurrMove->i;
- X if (i >= 0) {
- X Game->Board [i] [j= Game->CurrMove->j]= s;
- X if (Draw) DrawMove (Game, Game->CurrMove, i, j);
- X NewStoneToGroups (Game, i, j);
- X if (GenCaptures (Game, !s, Game->CurrMove)) {
- X if (Draw) {
- X for (c= Game->CurrMove->Captures; c != NULL; c= c->Next) {
- X DrawEmpty (Game, c->i, c->j);
- X }
- X }
- X }
- X }
- X if (Draw) {
- X Status (Game);
- X StdMsg ();
- X if ((Game->CurrMove) && (Game->CurrMove->Prev)) {
- X i= Game->CurrMove->Prev->i;
- X j= Game->CurrMove->Prev->j;
- X UnHighlightMove (Game, i, j);
- X }
- X if (Game->CurrMove) {
- X if (Game->CurrMove->Next) DrawAlts (Game, Game->CurrMove);
- X NewText (Game->CurrMove->Note);
- X LabelToPanel (Game->CurrMove->Next);
- X } else {
- X NewText (Game->CurrMove->Note);
- X }
- X }
- X} /* Step */
- X
- X
- XUnHighlightMove (Game, i, j)
- X GameType *Game;
- X int i, j;
- X{
- Xint Color;
- X if (Game->Board [i][j] == Black) Color= 1;
- X else if (Game->Board [i][j] == White) Color= 0;
- X else return;
- X Disk (BoardPW, 2 * LineWidth, GridX (i), GridY (j), Color);
- X} /* UnHighlightMove */
- END_OF_FILE
- if test 15937 -ne `wc -c <'goboard.c'`; then
- echo shar: \"'goboard.c'\" unpacked with wrong size!
- fi
- # end of 'goboard.c'
- fi
- if test -f 'gocapture.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'gocapture.c'\"
- else
- echo shar: Extracting \"'gocapture.c'\" \(12236 characters\)
- sed "s/^X//" >'gocapture.c' <<'END_OF_FILE'
- X#ifndef lint
- Xstatic char sccsid[]= "@(#)gocapture.c 1.3 87/01/11 Copyr 1986 Sun Micro";
- X#endif
- X
- X/* Copyright (c) Sun MicroSystems, 1986. This code may be used and modified
- X for not-for-profit use. This notice must be retained. */
- X
- X#include "goban.h"
- X
- X
- XGroupType *UniteGroups ();
- X
- X
- XCheckCaptures (Game, Color, i, j)
- X GameType *Game;
- X Stone Color;
- X int i, j;
- X/* Find all unique groups of Color with no liberties.
- X Color is the opposite color to the moving player.
- X Returns number of stones that would be captured.
- X*/
- X{
- Xint NumGroups, NumCaptures, k, kk, kkk;
- XGroupType *Captures [4];
- X NumGroups= 0;
- X if ((i > 0) && (Game->Board [i-1][j] == Color) &&
- X (Game->Groups [i-1][j]->NumLibs <= 1))
- X Captures [NumGroups++]= Game->Groups [i-1][j];
- X if ((j > 0) && (Game->Board [i][j-1] == Color) &&
- X (Game->Groups [i][j-1]->NumLibs <= 1))
- X Captures [NumGroups++]= Game->Groups [i][j-1];
- X if ((i < (Game->Grid-1)) && (Game->Board [i+1][j] == Color) &&
- X (Game->Groups [i+1][j]->NumLibs <= 1))
- X Captures [NumGroups++]= Game->Groups [i+1][j];
- X if ((j < (Game->Grid-1)) && (Game->Board [i][j+1] == Color) &&
- X (Game->Groups [i][j+1]->NumLibs <= 1))
- X Captures [NumGroups++]= Game->Groups [i][j+1];
- X for (k= 1; k < NumGroups; k++) {
- X for (kk= 0; kk < k; kk++) {
- X if (Captures [k] == Captures [kk]) {
- X for (kkk= k+1; kkk < NumGroups; kkk++) {
- X Captures [kkk-1]= Captures [kkk];
- X }
- X NumGroups--;
- X }
- X }
- X }
- X for (k= 0, NumCaptures= 0; k < NumGroups; k++)
- X NumCaptures += Captures [k]->NumStones;
- X return NumCaptures;
- X} /* CheckCaptures */
- X
- X
- XCountGrpLibs (Game, i, j, Match, g, RecursionLevel)
- X GameType *Game;
- X int i, j;
- X Stone Match;
- X GroupType *g;
- X int RecursionLevel; /* Zero on first call. */
- X{
- X
- X#define CountGrpLibs0(a,b,c) \
- X if ((a) && (Checked [b][c] < CheckNum)) { \
- X Checked [b][c]= CheckNum; \
- X Color= Game->Board [b][c]; \
- X if (Color == Match) CountGrpLibs (Game, b, c, Match, g, 1); \
- X else if (Color == Empty) g->NumLibs++; \
- X }
- X
- XStone Color;
- X if (RecursionLevel == 0) {
- X g->NumLibs= 0;
- X Checked [i][j]= ++CheckNum;
- X }
- X CountGrpLibs0 ((i > 0), i-1, j);
- X CountGrpLibs0 ((j > 0), i, j-1);
- X CountGrpLibs0 ((i < Game->Grid-1), i+1, j);
- X CountGrpLibs0 ((j < Game->Grid-1), i, j+1);
- X} /* CountGrpLibs */
- X
- X
- X int
- XCountLibs (Game, i, j)
- X GameType *Game;
- X int i, j;
- X/* Count liberties of a single isolated stone.
- X Assumes stone is already on board.
- X*/
- X{
- Xint NumLibs, LastLine;
- X LastLine= Game->Grid - 1;
- X NumLibs= 0;
- X if ((i > 0) && (Game->Board [i-1][j] == Empty)) {
- X NumLibs++;
- X }
- X if ((j > 0) && (Game->Board [i][j-1] == Empty)) {
- X NumLibs++;
- X }
- X if ((i < LastLine) && (Game->Board [i+1][j] == Empty)) {
- X NumLibs++;
- X }
- X if ((j < LastLine) && (Game->Board [i][j+1] == Empty)) {
- X NumLibs++;
- X }
- X return NumLibs;
- X} /* CountLibs */
- X
- X
- XDebugGroups (Groups)
- X GroupType *Groups [MaxGrid] [MaxGrid];
- X{
- XGroupType *g;
- Xint i, j;
- X for (j= 9; j >= 3; j--) {
- X for (i= 13; i < 19; i++) {
- X g= Groups [i] [j];
- X printf (" %7lx", g);
- X if (g != NULL) printf (" %c%d", g->Color ? 'o' : '*', g->NumLibs);
- X else printf (" ");
- X }
- X printf ("\n");
- X }
- X printf ("\n");
- X} /* DebugGroups */
- X
- X
- X int
- XFindEnemies (i, j, Game, Enemies)
- X int i, j;
- X GameType *Game;
- X GroupType *Enemies [4];
- X/* Call by reference variable side effect: Enemies.
- X Returns number of neighboring stones found of opposing color.
- X Watch out for stone touching a group twice.
- X*/
- X{
- Xint Num, k, c; /* c == color. */
- X c= !Game->Board [i][j];
- X Num= 0;
- X if ((i > 0) && (Game->Board [i-1][j] == c))
- X Enemies [Num++]= Game->Groups [i-1][j];
- X if ((j > 0) && (Game->Board [i][j-1] == c))
- X Enemies [Num++]= Game->Groups [i][j-1];
- X if ((i < (Game->Grid - 1)) && (Game->Board [i+1][j] == c))
- X Enemies [Num++]= Game->Groups [i+1][j];
- X if ((j < (Game->Grid - 1)) && (Game->Board [i][j+1] == c))
- X Enemies [Num++]= Game->Groups [i][j+1];
- X /* Check for Duplicates. */
- X for (i= 0; i < (Num-1); i++) {
- X for (j= i+1; j < Num; j++) {
- X if (Enemies [i] == Enemies [j]) {
- X for (k= j; k < (Num-1); k++) Enemies [k]= Enemies [k+1];
- X Num--;
- X j--; /* Since a new neighbor is at j position. */
- X }
- X }
- X }
- X return Num;
- X} /* FindEnemies */
- X
- X
- X int
- XFindFriends (i, j, Game, c, Neighbors)
- X int i, j;
- X GameType *Game;
- X int c; /* c == color. */
- X GroupType *Neighbors [4];
- X/* Call by reference variable side effect: Neighbors.
- X Returns number of neighboring stones found of same color.
- X Watch out for stone touching a group twice.
- X*/
- X{
- Xint Num, k;
- X Num= 0;
- X if ((i > 0) && (Game->Board [i-1][j] == c))
- X Neighbors [Num++]= Game->Groups [i-1][j];
- X if ((j > 0) && (Game->Board [i][j-1] == c))
- X Neighbors [Num++]= Game->Groups [i][j-1];
- X if ((i < (Game->Grid - 1)) && (Game->Board [i+1][j] == c))
- X Neighbors [Num++]= Game->Groups [i+1][j];
- X if ((j < (Game->Grid - 1)) && (Game->Board [i][j+1] == c))
- X Neighbors [Num++]= Game->Groups [i][j+1];
- X /* Eliminate Duplicates. */
- X for (i= 0; i < (Num-1); i++) {
- X for (j= i+1; j < Num; j++) {
- X if (Neighbors [i] == Neighbors [j]) {
- X for (k= j; k < (Num-1); k++) Neighbors [k]= Neighbors [k+1];
- X Num--;
- X j--; /* Since a new neighbor is at j position. */
- X }
- X }
- X }
- X return Num;
- X} /* FindFriends */
- X
- X
- X int
- XGenCaptures (Game, Color, Move)
- X GameType *Game;
- X int Color;
- X MoveType *Move;
- X/* Find all groups of Color with no liberties and removes them, putting
- X the captures into the Move. Color is the opposite color to the
- X moving player.
- X*/
- X{
- Xint i, j, k, NumCaptures;
- XGroupType **g, *Grp, *Neighbors [4];
- XCaptureType *c;
- XStone *s;
- X if (Move->Captures != NULL) {
- X FreeCaptures (Move->Captures);
- X Move->Captures= NULL;
- X }
- X for (i= 0, NumCaptures= 0; i < Game->Grid; i++) {
- X g= Game->Groups [i];
- X s= Game->Board [i];
- X for (j= 0; j < Game->Grid; j++, s++, g++) {
- X Grp= *g;
- X if ((Grp != NULL) && (Grp->Color == Color)) {
- X if (Grp->NumLibs == 0) {
- X NumCaptures++;
- X k= FindEnemies (i, j, Game, Neighbors) - 1;
- X for (; k >= 0; k--) {
- X Neighbors [k]->NumLibs++;
- X }
- X *s= Empty;
- X Game->Prisoners [Color]++;
- X c= AllocCapture (i, j);
- X c->Next= Move->Captures;
- X Move->Captures= c;
- X Grp->NumStones--;
- X if (Grp->NumStones <= 0)
- X FreeGroup (Grp);
- X *g= NULL;
- X }
- X }
- X }
- X }
- X return NumCaptures;
- X} /* GenCaptures */
- X
- X
- XNewStoneToGroups (Game, i, j)
- X GameType *Game;
- X int i, j;
- X/* Adjusts group map to include presence of new stone at i, j.
- X*/
- X{
- XGroupType *g, *Neighbors [4];
- X /* First stores Neighbors, then Enemies. */
- Xint NumNeighbors, NumEnemies;
- Xint k;
- X if (Game->Board [i][j] == Empty) {
- X fprintf (stderr, "NewStonetoGroups (%d, %d, Game) is Empty.\n", i, j);
- X }
- X NumNeighbors= FindFriends (i, j, Game, Game->Board [i][j], Neighbors);
- X switch (NumNeighbors) {
- X case 0: /* New Group */
- X Game->Groups [i][j]= g= AllocGroup (Game->Board [i][j], 0, 1);
- X g->NumLibs = CountLibs (Game, i, j);
- X break;
- X case 1:
- X g= Game->Groups [i][j]= Neighbors [0];
- X g->NumStones++;
- X CountGrpLibs (Game, i, j, Game->Board [i][j], g, 0);
- X break;
- X default:
- X g= UniteGroups (i, j, Neighbors, NumNeighbors, Game);
- X } /* switch */
- X NumEnemies= FindEnemies (i, j, Game, Neighbors);
- X for (k= 0; k < NumEnemies; k++) Neighbors [k]->NumLibs--;
- X if (DebugLevel == 1) {
- X printf ("NewStonetoGroups %d %d\n", i, j);
- X DebugGroups (Game->Groups);
- X }
- X} /* NewStoneToGroups */
- X
- X
- XNullGroups (Game)
- X GameType *Game;
- X/* Set Group map entries to NULL. */
- X{
- Xint i, j;
- X for (i= 0; i < MaxGrid; i++)
- X for (j= 0; j < MaxGrid; j++)
- X if (Game->Groups [i][j] != NULL) {
- X FreeGroup (Game->Groups [i][j]);
- X Game->Groups [i][j]= NULL;
- X }
- X for (i= 0; i < MaxGrid; i++)
- X for (j= 0; j < MaxGrid; j++)
- X if (Game->InitialBoard [i][j] != Empty) {
- X Game->Groups [i][j]=
- X AllocGroup (Game->InitialBoard [i][j], 4, 1);
- X }
- X} /* NullGroups */
- X
- X
- X int
- XRemGroup (Game, i, j, c, Dir, LastLine)
- X GameType *Game;
- X int i, j;
- X Stone c;
- X int Dir, LastLine;
- X /* Dir is Direction this call is going. */
- X{
- Xint s = 0;
- XGroupType *g;
- X if (Dir == NoDir) g= Game->Groups [i][j];
- X Game->Groups [i][j]= NULL;
- X if ((Dir != East) && (i > 0) && (Game->Board [i-1][j] == c)
- X && (Game->Groups [i-1][j] != NULL)) {
- X s |= West;
- X RemGroup (Game, i-1, j, c, West, LastLine);
- X }
- X if ((Dir != North) && (j > 0) && (Game->Board [i][j-1] == c)
- X && (Game->Groups [i][j-1] != NULL)) {
- X s |= South;
- X RemGroup (Game, i, j-1, c, South, LastLine);
- X }
- X if ((Dir != West) && (i < LastLine) && (Game->Board [i+1][j] == c)
- X && (Game->Groups [i+1][j] != NULL)) {
- X s |= East;
- X RemGroup (Game, i+1, j, c, East, LastLine);
- X }
- X if ((Dir != South) && (j < LastLine) && (Game->Board [i][j+1] == c)
- X && (Game->Groups [i][j+1] != NULL)) {
- X s |= North;
- X RemGroup (Game, i, j+1, c, North, LastLine);
- X }
- X if (Dir == NoDir) FreeGroup (g);
- X return s;
- X} /* RemGroup */
- X
- X
- XRemoveStone (Game, i, j)
- X GameType *Game;
- X int i, j;
- X/* When splitting the group that the stone i,j is in, be sure to
- X watch for a group that comes around and touches twice.
- X*/
- X{
- X#define NullGrp (GroupType *) NULL
- Xint LastLine, Dirs, k;
- XStone c;
- XGroupType *Neighbors [4];
- X for (k= FindEnemies (i, j, Game, Neighbors) - 1; k >= 0; k--) {
- X Neighbors [k]->NumLibs++;
- X }
- X c= Game->Board [i][j];
- X Game->Board [i][j]= Empty;
- X LastLine= Game->Grid - 1;
- X if (Dirs= RemGroup (Game, i, j, c, NoDir, LastLine)) {
- X if (Dirs & West) {
- X RestoreGroup (Game, i-1, j, c, West, LastLine, NullGrp);
- X CountGrpLibs (Game, i-1, j, c, Game->Groups [i-1][j], 0);
- X }
- X if (Dirs & South) {
- X RestoreGroup (Game, i, j-1, c, South, LastLine, NullGrp);
- X CountGrpLibs (Game, i, j-1, c, Game->Groups [i][j-1], 0);
- X }
- X if (Dirs & East) {
- X RestoreGroup (Game, i+1, j, c, East, LastLine, NullGrp);
- X CountGrpLibs (Game, i+1, j, c, Game->Groups [i+1][j], 0);
- X }
- X if (Dirs & North) {
- X RestoreGroup (Game, i, j+1, c, North, LastLine, NullGrp);
- X CountGrpLibs (Game, i, j+1, c, Game->Groups [i][j+1], 0);
- X }
- X }
- X} /* RemoveStone */
- X
- X
- XRestoreGroup (Game, i, j, c, Dir, LastLine, g)
- X GameType *Game;
- X int i, j;
- X Stone c;
- X int Dir, LastLine;
- X GroupType *g;
- X/* Seeks out stones and fills in group map. Used for each branch when
- X removing a single stone splits a group. Since all contiguous stones
- X have just prior been removed, don't have to worry about uniting groups.
- X*/
- X{
- X if (g == NULL) {
- X g= AllocGroup (c, 0, 1);
- X Game->Groups [i][j]= g;
- X } else {
- X Game->Groups [i][j]= g;
- X g->NumStones++;
- X }
- X if ((Dir != East) && (i > 0) && (Game->Board [i-1][j] == c)
- X && (Game->Groups [i-1] [j] != g)) {
- X RestoreGroup (Game, i-1, j, c, West, LastLine, g);
- X }
- X if ((Dir != North) && (j > 0) && (Game->Board [i][j-1] == c)
- X && (Game->Groups [i] [j-1] != g)) {
- X RestoreGroup (Game, i, j-1, c, South, LastLine, g);
- X }
- X if ((Dir != West) && (i < LastLine) && (Game->Board [i+1][j] == c)
- X && (Game->Groups [i+1] [j] != g)) {
- X RestoreGroup (Game, i+1, j, c, East, LastLine, g);
- X }
- X if ((Dir != South) && (j < LastLine) && (Game->Board [i][j+1] == c)
- X && (Game->Groups [i] [j+1] != g)) {
- X RestoreGroup (Game, i, j+1, c, North, LastLine, g);
- X }
- X} /* RestoreGroup */
- X
- X
- X GroupType *
- XUniteGroups (ii, jj, Neighbors, NumNeighbors, Game)
- X int ii, jj;
- X GroupType *Neighbors [4];
- X int NumNeighbors;
- X GameType *Game;
- X/* Unite Group of Stone ii, jj with list of Neighbors. Group of ii, jj
- X is subsumed by last Neighbor which subsumes the other neighbor groups.
- X Free Neighbor groups.
- X*/
- X{
- XGroupType *g;
- Xint i, j, k;
- XStone c;
- X c= Game->Board [ii][jj];
- X g= Neighbors [--NumNeighbors];
- X Game->Groups [ii][jj]= g;
- X g->NumStones++; /* for stone at ii, jj. */
- X if (NumNeighbors <= 0) return 0;
- X for (i= 0; i < Game->Grid; i++) {
- X for (j= 0; j < Game->Grid; j++) {
- X for (k= 0; k < NumNeighbors; k++)
- X if (Game->Groups [i][j] == Neighbors [k]) {
- X Game->Groups [i][j]= g;
- X g->NumStones++;
- X }
- X }
- X }
- X for (k= 0; k < NumNeighbors; k++) {
- X FreeGroup (Neighbors [k]);
- X }
- X CountGrpLibs (Game, ii, jj, c, g, 0);
- X return g;
- X} /* UniteGroups */
- END_OF_FILE
- if test 12236 -ne `wc -c <'gocapture.c'`; then
- echo shar: \"'gocapture.c'\" unpacked with wrong size!
- fi
- # end of 'gocapture.c'
- fi
- if test -f 'gocircle.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'gocircle.c'\"
- else
- echo shar: Extracting \"'gocircle.c'\" \(1913 characters\)
- sed "s/^X//" >'gocircle.c' <<'END_OF_FILE'
- X#ifndef lint
- Xstatic char sccsid[]= "@(#)gocircle.c 1.3 87/01/11 Copyr 1986 Sun Micro";
- X#endif
- X
- X/* Copyright (c) Sun MicroSystems, 1986. This code may be used and modified
- X for not-for-profit use. This notice must be retained. */
- X
- X#include <sunwindow/window_hs.h>
- X
- X
- XDisk (pw, Radius, CtrX, CtrY, Value)
- X struct pixwin *pw;
- X int Radius, CtrX, CtrY, Value;
- X{
- Xint x, y, d;
- X x= 0;
- X y= Radius;
- X d= 3 - 2 * Radius;
- X while (x < y) {
- X DiskPoints (pw, CtrX, CtrY, x, y, Value);
- X if (d < 0) d= d + (4 * x) + 6;
- X else {
- X d= d + (4 * (x - y)) + 10;
- X y--;
- X }
- X x++;
- X }
- X if (x == y) DiskPoints (pw, CtrX, CtrY, x, y, Value);
- X} /* Disk */
- X
- X
- XDiskPoints (pw, CtrX, CtrY, x, y, Color)
- X struct pixwin *pw;
- X int CtrX, CtrY, x, y, Color;
- X{
- X pw_vector (pw, CtrX - x, CtrY - y, CtrX + x, CtrY - y, PIX_SRC, Color);
- X pw_vector (pw, CtrX - x, CtrY + y, CtrX + x, CtrY + y, PIX_SRC, Color);
- X pw_vector (pw, CtrX - y, CtrY - x, CtrX + y, CtrY - x, PIX_SRC, Color);
- X pw_vector (pw, CtrX - y, CtrY + x, CtrX + y, CtrY + x, PIX_SRC, Color);
- X} /* DiskPoints */
- X
- X
- XDiskPR (pr, Radius, CtrX, CtrY, Value)
- X struct pixrect *pr;
- X int Radius, CtrX, CtrY, Value;
- X{
- Xint x, y, d;
- X x= 0;
- X y= Radius;
- X d= 3 - 2 * Radius;
- X while (x < y) {
- X DiskPointsPR (pr, CtrX, CtrY, x, y, Value);
- X if (d < 0) d= d + (4 * x) + 6;
- X else {
- X d= d + (4 * (x - y)) + 10;
- X y--;
- X }
- X x++;
- X }
- X if (x == y) DiskPointsPR (pr, CtrX, CtrY, x, y, Value);
- X} /* DiskPR */
- X
- X
- XDiskPointsPR (pr, CtrX, CtrY, x, y, Color)
- X struct pixrect *pr;
- X int CtrX, CtrY, x, y, Color;
- X{
- X pr_vector (pr, CtrX - x, CtrY - y, CtrX + x, CtrY - y, PIX_SRC, Color);
- X pr_vector (pr, CtrX - x, CtrY + y, CtrX + x, CtrY + y, PIX_SRC, Color);
- X pr_vector (pr, CtrX - y, CtrY - x, CtrX + y, CtrY - x, PIX_SRC, Color);
- X pr_vector (pr, CtrX - y, CtrY + x, CtrX + y, CtrY + x, PIX_SRC, Color);
- X} /* DiskPointsPR */
- END_OF_FILE
- if test 1913 -ne `wc -c <'gocircle.c'`; then
- echo shar: \"'gocircle.c'\" unpacked with wrong size!
- fi
- # end of 'gocircle.c'
- fi
- if test -f 'gomaster.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'gomaster.c'\"
- else
- echo shar: Extracting \"'gomaster.c'\" \(5799 characters\)
- sed "s/^X//" >'gomaster.c' <<'END_OF_FILE'
- X#ifndef lint
- Xstatic char sccsid[]= "@(#)gomaster.c 1.1 87/01/11 Copyr 1986 Sun Micro";
- X#endif
- X
- X/* Copyright (c) Sun MicroSystems, 1986. This code may be used and modified
- X for not-for-profit use. This notice must be retained. */
- X
- X#include "goban.h"
- X#include <suntool/panel.h>
- X
- Xextern Panel_item CurrMoveSlider, HandicapSlider, NameButton;
- X
- X
- XBookMove (i, j, Move, Color, Game)
- X int i, j;
- X MoveType *Move;
- X Stone *Color;
- X GameType *Game;
- X{
- Xint NumCaptures;
- XStone c;
- X c= *Color;
- X AllocMove (i, j, Move);
- X Game->Board [i] [j]= c;
- X NewStoneToGroups (Game, i, j);
- X NumCaptures= GenCaptures (Game, !c, Move);
- X Game->NumMoves++;
- X if (c == Black) *Color= White;
- X else *Color= Black;
- X} /* BookMove */
- X
- X
- XDfltGame (GameName, Game, ShouldPaint)
- X char *GameName; GameType *Game;
- X Panel_setting ShouldPaint;
- X/* Fills in a Game structure with the game from the book "Master of Go"
- X by Yasunari Kawabata.
- X*/
- X{
- XMoveType *Move;
- XStone Color;
- Xint i, j, NumCaptures;
- X strcpy (GameName, "masterofgo");
- X panel_set (NameButton, PANEL_VALUE, GameName, 0);
- X Game->Grid= 19;
- X Game->Handicap= 0;
- X ZeroGame (Game, ShouldPaint);
- X strncpy (Game->Title, GameName, MaxTitleChars-1);
- X for (i= 0; i < Game->Grid; i++)
- X for (j= 0; j < Game->Grid; j++) {
- X Game->Board [i] [j]= Empty;
- X }
- X Game->FirstPlayer= Color= Black;
- X Game->MoveList= Move= AllocMove (i=16, j=15, (MoveType *) NULL);
- X Game->Board [i][j]= Color;
- X NewStoneToGroups (Game, i, j);
- X NumCaptures= GenCaptures (Game, !Color, Move);
- X Game->NumMoves++;
- X Color= White;
- X#define BM(i,j) BookMove (i, j, Move, &Color, Game); Move= Move->Next
- X BM (16, 3);
- X BM (3, 2);
- X BM (2, 4);
- X BM (4, 3);
- X BM (14, 15);
- X BM (14, 16);
- X BM (13, 16);
- X BM (15, 16);
- X BM (12, 15);
- X BM (13, 14);
- X BM (14, 14);
- X BM (13, 17);
- X BM (13, 13);
- X BM (12, 17);
- X BM (13, 2);
- X BM (15, 13);
- X BM (2, 14);
- X BM (2, 16);
- X BM (4, 15);
- X BM (4, 16);
- X BM (5, 16);
- X BM (5, 15);
- X BM (6, 15);
- X BM (5, 14);
- X BM (4, 14);
- X BM (6, 16);
- X BM (5, 17);
- X BM (4, 17);
- X BM (6, 17);
- X BM (5, 13);
- X BM (7, 16);
- X BM (4, 13);
- X BM (2, 15);
- X BM (1, 16);
- X BM (2, 11);
- X BM (3, 10);
- X BM (2, 10);
- X BM (3, 9);
- X BM (2, 9);
- X BM (3, 8);
- X BM (2, 8);
- X BM (3, 7);
- X BM (2, 6);
- X BM (3, 5);
- X BM (2, 5);
- X BM (3, 6);
- X BM (9, 3);
- X BM (9, 16);
- X BM (9, 14);
- X BM (8, 14);
- X BM (9, 15);
- X BM (8, 15);
- X BM (8, 16);
- X BM (10, 16);
- X BM (8, 13);
- X BM (7, 14);
- X BM (9, 13);
- X BM (7, 13);
- X BM (9, 17);
- X BM (10, 17);
- X BM (8, 18);
- X BM (13, 4);
- X BM (13, 3);
- X BM (11, 4);
- X BM (11, 3);
- X BM (11, 14);
- X BM (11, 13);
- X BM (10, 13);
- X BM (12, 14);
- X BM (11, 12);
- X BM (12, 13);
- X BM (10, 15);
- X BM (10, 12);
- X BM (10, 14);
- X BM (11, 11);
- X BM (9, 12);
- X BM (12, 12);
- X BM (15, 11);
- X BM (9, 11);
- X BM (8, 12);
- X BM (16, 7);
- X BM (16, 9);
- X BM (17, 9);
- X BM (17, 10);
- X BM (14, 7);
- X BM (17, 8);
- X BM (10, 4);
- X BM (7, 2);
- X BM (7, 3);
- X BM (6, 3);
- X BM (6, 2);
- X BM (7, 1);
- X BM (8, 2);
- X BM (7, 4);
- X BM (8, 3);
- X BM (6, 1);
- X BM (10, 7);
- X BM (10, 10);
- X BM (10, 11);
- X BM (17, 6);
- X BM (17, 7);
- X BM (18, 7);
- X BM (16, 6);
- X BM (17, 5);
- X BM (16, 4);
- X BM (1, 3);
- X BM (3, 12);
- X BM (1, 15);
- X BM (1, 14);
- X BM (3, 16);
- X BM (6, 4);
- X BM (5, 2);
- X BM (7, 5);
- X BM (14, 9);
- X BM (13, 9);
- X BM (13, 10);
- X BM (12, 9);
- X BM (14, 8);
- X BM (13, 8);
- X BM (7, 15);
- X BM (7, 17);
- X BM (16, 5);
- X BM (15, 5);
- X BM (18, 3);
- X BM (17, 2);
- X BM (12, 10);
- X BM (11, 10);
- X BM (13, 7);
- X BM (17, 4);
- X BM (13, 6);
- X BM (14, 6);
- X BM (11, 9);
- X BM (12, 8);
- X BM (11, 8);
- X BM (12, 7);
- X BM (11, 7);
- X BM (12, 6);
- X BM (11, 6);
- X BM (12, 5);
- X BM (11, 5);
- X BM (12, 4);
- X BM (9, 9);
- X BM (8, 1);
- X BM (18, 4);
- X BM (18, 2);
- X BM (18, 6);
- X BM (1, 4);
- X BM (1, 2);
- X BM (8, 8);
- X BM (8, 9);
- X BM (7, 9);
- X BM (8, 10);
- X BM (9, 8);
- X BM (7, 7);
- X BM (7, 8);
- X BM (5, 4);
- X BM (6, 5);
- X BM (6, 7);
- X BM (8, 7);
- X BM (2, 7);
- X BM (1, 7);
- X BM (13, 11);
- X BM (12, 11);
- X BM (16, 8);
- X BM (14, 12);
- X BM (15, 12);
- X BM (4, 18);
- X BM (3, 18);
- X BM (5, 18);
- X BM (1, 18);
- X BM (7, 6);
- X BM (8, 0);
- X BM (9, 0);
- X BM (7, 0);
- X BM (9, 1);
- X BM (0, 14);
- X BM (0, 13);
- X BM (0, 15);
- X BM (2, 13);
- X BM (15, 7);
- X BM (15, 6);
- X BM (15, 8);
- X BM (13, 5);
- X BM (5, 6);
- X BM (5, 5);
- X BM (4, 5);
- X BM (0, 4);
- X BM (10, 6);
- X BM (9, 6);
- X BM (5, 8);
- X BM (3, 4);
- X BM (4, 4);
- X BM (7, 10);
- X BM (8, 11);
- X BM (5, 9);
- X BM (3, 15);
- X BM (4, 9);
- X BM (4, 8);
- X BM (3, 14);
- X BM (1, 12);
- X BM (1, 13);
- X BM (2, 12);
- X BM (1, 11);
- X BM (3, 13);
- X BM (0, 12);
- X BM (3, 11);
- X BM (5, 11);
- X BM (4, 11);
- X BM (2, 12);
- X BM (5, 10);
- X BM (6, 10);
- X BM (4, 10);
- X BM (10, 8);
- X BM (10, 9);
- X BM (6, 12);
- X BM (10, 18);
- X BM (9, 18);
- X BM (10, 5);
- X BM (9, 5);
- X BM (6, 9);
- X BM (6, 8);
- X BM (5, 9);
- X BM (6, 6);
- X BM (5, 7);
- X BM (0, 3);
- X BM (0, 2);
- X BM (2, 3);
- X BM (2, 2);
- X BM (14, 11);
- X BM (14, 10);
- X BM (15, 14);
- X BM (16, 14);
- X BM (13, 15);
- X BM (18, 8);
- X BM (11, 16);
- X BM (11, 17);
- X SetFirstPlayerButton (Color, ShouldPaint);
- X Game->MoveNum= Game->NumMoves;
- X panel_set (CurrMoveSlider
- X , PANEL_MAX_VALUE, Game->NumMoves
- X , PANEL_VALUE, Game->MoveNum
- X , PANEL_PAINT, ShouldPaint, 0);
- X panel_set (HandicapSlider, PANEL_VALUE, Game->Handicap
- X , PANEL_PAINT, ShouldPaint, 0);
- X if (Game->MoveList != NULL) Game->CurrMove= Move;
- X return 0;
- X} /* DfltGame */
- END_OF_FILE
- if test 5799 -ne `wc -c <'gomaster.c'`; then
- echo shar: \"'gomaster.c'\" unpacked with wrong size!
- fi
- # end of 'gomaster.c'
- fi
- if test -f 'gopanel.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'gopanel.c'\"
- else
- echo shar: Extracting \"'gopanel.c'\" \(17631 characters\)
- sed "s/^X//" >'gopanel.c' <<'END_OF_FILE'
- X#ifndef lint
- Xstatic char sccsid[]= "@(#)gopanel.c 1.3 87/01/11 Copyr 1986 Sun Micro";
- X#endif
- X
- X/* Copyright (c) Sun MicroSystems, 1986. This code may be used and modified
- X for not-for-profit use. This notice must be retained. */
- X
- X#include "goban.h"
- X#include <suntool/canvas.h>
- X#include <suntool/panel.h>
- X#include <suntool/textsw.h>
- X#include <suntool/fullscreen.h>
- X
- X
- Xstruct pixrect *MovingImage, *PlacingImage;
- Xchar StdMessage [] =
- X"Left: new branch. Ctrl left: place. Center: Backup. Right: Step.";
- X
- Xextern Canvas BoardSW;
- Xextern Panel_item CurrMoveSlider;
- Xextern Panel_item FirstPlayerButton;
- Xextern Panel_item HandicapSlider;
- Xextern Panel_item LabelButton;
- Xextern Panel MainPanel;
- Xextern Panel_item MsgPanelItem;
- Xextern Panel_item NameButton;
- Xextern Panel_item PlaceMoveButton;
- Xextern Panel_item StatusPanelItem;
- Xextern Textsw TextSW;
- Xextern int UserTextMods;
- Xextern int Verbose;
- X
- Xextern SaveText ();
- X
- X/* Forward */
- XAltProc ();
- XCloseProc ();
- XFirstPlayProc ();
- XHandicapProc ();
- XLeafwardNotify ();
- XPanel_setting MoveLabelNotify ();
- XPassProc ();
- XPlaceMoveProc ();
- XPrintProc ();
- XPruneProc ();
- XQuit ();
- XReadGameProc ();
- XReplayProc ();
- XResetProc ();
- XRootwardNotify ();
- XSetCurrMove ();
- XVerboseNotify ();
- XWriteBoardProc ();
- XWriteGameProc ();
- X
- X
- XAltProc (PI, GoEvent)
- X Panel_item PI;
- X struct inputevent *GoEvent;
- X{
- XGameType *Game;
- XMoveType *m;
- X Game= (GameType *) panel_get (PI, PANEL_CLIENT_DATA);
- X if ((Game->CurrMove != NULL) && (Game->CurrMove->AltNext != NULL)) {
- X Sideways (Game, 1);
- X }
- X} /* AltProc */
- X
- X
- XCloseProc (PI, GoEvent)
- X Panel_item PI;
- X struct inputevent *GoEvent;
- X/* Close tool to icon state. */
- X{
- X wmgr_close (window_get (GoFrame, WIN_FD), RootFD);
- X} /* CloseProc */
- X
- X
- X int
- XConfirm ()
- X{
- Xstruct fullscreen *FullScreen;
- Xstruct inputmask im;
- Xstruct inputevent ie;
- Xint result;
- Xint FD;
- X Msg ("Confirm: right mouse button. Deny: left & center buttons.");
- X FD= (int) window_get (MainPanel, WIN_FD);
- X FullScreen= (struct fullscreen *) fullscreen_init (FD);
- X input_imnull (&im);
- X win_setinputcodebit (&im, MS_LEFT);
- X win_setinputcodebit (&im, MS_MIDDLE);
- X win_setinputcodebit (&im, MS_RIGHT);
- X win_setinputmask (FD, &im, (struct inputmask *) NULL, WIN_NULLLINK);
- X for (;;) { /* improve this do loop to eliminate for (;;). */
- X if (input_readevent (FD, &ie) == -1) {
- X perror("Confirm input failed.");
- X abort ();
- X }
- X switch (ie.ie_code) {
- X case MS_LEFT: result = FALSE; break;
- X case MS_MIDDLE: result = FALSE; break;
- X case MS_RIGHT: result = TRUE; break;
- X default: continue;
- X }
- X break;
- X }
- X fullscreen_destroy (FullScreen);
- X StdMsg ();
- X return result;
- X} /* Confirm */
- X
- X
- XFirstPlayProc (PI, GoEvent)
- X Panel_item PI;
- X struct inputevent *GoEvent;
- X/* Toggles first player of game. */
- X{
- XGameType *Game;
- X Game= (GameType *) panel_get (PI, PANEL_CLIENT_DATA);
- X if (Game->NumMoves == 0) SetFirst (Game, !Game->FirstPlayer, PANEL_CLEAR);
- X} /* FirstPlayProc */
- X
- X
- X struct pixrect *
- XGenStoneImage (p, Color)
- X struct pixrect *p;
- X int Color;
- X{
- Xint Width, Height, LineWid;
- Xint i;
- X if (p != NULL) free (p);
- X Width= 25;
- X Height= 25;
- X LineWid= 2;
- X p= mem_create (Width, Height, 1);
- X for (i= 0; i < LineWid; i++) {
- X pr_vector (p, 0, Height/2 + i, Width, Height/2 + i, PIX_SRC, 1);
- X pr_vector (p, Width/2 + i, 0, Width/2 +i, Height, PIX_SRC, 1);
- X }
- X DiskPR (p, Width / 3, Width / 2, Width / 2, 1);
- X if (Color == White) DiskPR (p, Width/3 - LineWid, Width/2, Width/2, 0);
- X return p;
- X} /* GenStoneImage */
- X
- X
- XHandicapProc (PI, Value, GoEvent)
- X Panel_item PI;
- X unsigned int Value;
- X struct inputevent *GoEvent;
- X/* Sets handicap for game. */
- X{
- XGameType *Game;
- X Game= (GameType *) panel_get (PI, PANEL_CLIENT_DATA);
- X SetHandicap (Game, (int) Value);
- X} /* HandicapProc */
- X
- X
- XInitPanel (Game, GameName, MsgSW, StatusSW)
- X GameType *Game;
- X char *GameName;
- X Panel MsgSW, StatusSW;
- X{
- XPanel_item Junk;
- X#define NullFont (struct pixfont *) NULL
- X BlackFirstImage= GenStoneImage (BlackFirstImage, Black);
- X WhiteFirstImage= GenStoneImage (WhiteFirstImage, White);
- X FirstPlayerButton= panel_create_item (MainPanel, PANEL_CHOICE
- X , PANEL_DISPLAY_LEVEL, PANEL_CURRENT
- X , PANEL_CLIENT_DATA, (caddr_t) Game
- X , PANEL_NOTIFY_PROC, FirstPlayProc
- X , PANEL_LABEL_STRING, "Next: "
- X , PANEL_CHOICE_IMAGES, BlackFirstImage, WhiteFirstImage, 0
- X , PANEL_PAINT, PANEL_NONE
- X , 0); /* Remove PANEL_PAINT line in 3.0. */
- X MovingImage= panel_button_image (MainPanel, "Moving", 8, NullFont);
- X PlacingImage= panel_button_image (MainPanel, "Placing", 9, NullFont);
- X PlaceMoveButton= panel_create_item (MainPanel, PANEL_CHOICE
- X , PANEL_DISPLAY_LEVEL, PANEL_CURRENT
- X , PANEL_CLIENT_DATA, (caddr_t) Game
- X , PANEL_NOTIFY_PROC, PlaceMoveProc
- X , PANEL_CHOICE_IMAGES, PlacingImage, MovingImage, 0
- X , PANEL_VALUE, 1
- X , 0);
- X Junk= panel_create_item (MainPanel, PANEL_BUTTON
- X , PANEL_CLIENT_DATA, (caddr_t) Game
- X , PANEL_NOTIFY_PROC, PassProc
- X , PANEL_LABEL_IMAGE, panel_button_image (MainPanel, "Pass", 6, NullFont)
- X , 0);
- X Junk= panel_create_item (MainPanel, PANEL_BUTTON
- X , PANEL_CLIENT_DATA, (caddr_t) Game
- X , PANEL_NOTIFY_PROC, ReplayProc
- X , PANEL_LABEL_IMAGE
- X , panel_button_image (MainPanel, "Replay", 8, NullFont)
- X , 0);
- X/* Junk= panel_create_item (MainPanel, PANEL_BUTTON
- X , PANEL_CLIENT_DATA, (caddr_t) Game
- X , PANEL_NOTIFY_PROC, AltProc
- X , PANEL_LABEL_IMAGE, panel_button_image (MainPanel, "Alt", 5, NullFont)
- X , 0);
- X*/
- X Junk= panel_create_item (MainPanel, PANEL_BUTTON
- X , PANEL_CLIENT_DATA, (caddr_t) Game
- X , PANEL_NOTIFY_PROC, PruneProc
- X , PANEL_LABEL_IMAGE
- X , panel_button_image (MainPanel, "Prune", 7, NullFont)
- X , 0);
- X#ifdef LABEL_BUTTON
- X LabelButton= panel_create_item (MainPanel, PANEL_TEXT
- X , PANEL_CLIENT_DATA, (caddr_t) Game
- X , PANEL_VALUE, NULL
- X , PANEL_VALUE_DISPLAY_LENGTH, MaxMvLblChars-1
- X , PANEL_LABEL_STRING, "Label: "
- X , PANEL_NOTIFY_LEVEL, PANEL_ALL
- X , PANEL_NOTIFY_PROC, MoveLabelNotify
- X , 0);
- X#endif LABEL_BUTTON
- X Junk= panel_create_item (MainPanel, PANEL_BUTTON
- X , PANEL_CLIENT_DATA, (caddr_t) Game
- X , PANEL_VALUE, GameName
- X , PANEL_NOTIFY_PROC, RootwardNotify
- X , PANEL_LABEL_IMAGE
- X , panel_button_image (MainPanel, "Rootward", 10, NullFont)
- X , 0);
- X Junk= panel_create_item (MainPanel, PANEL_BUTTON
- X , PANEL_CLIENT_DATA, (caddr_t) Game
- X , PANEL_VALUE, GameName
- X , PANEL_NOTIFY_PROC, LeafwardNotify
- X , PANEL_LABEL_IMAGE
- X , panel_button_image (MainPanel, "Leafward", 10, NullFont)
- X , 0);
- X CurrMoveSlider= panel_create_item (MainPanel, PANEL_SLIDER
- X , PANEL_CLIENT_DATA, (caddr_t) Game
- X , PANEL_NOTIFY_PROC, SetCurrMove
- X , PANEL_MAX_VALUE, MaxMoves
- X , PANEL_VALUE, Game->NumMoves
- X , PANEL_LAYOUT, PANEL_VERTICAL
- X , PANEL_SLIDER_WIDTH, 250
- X , PANEL_LABEL_STRING, "Current Move: "
- X , 0);
- X HandicapSlider= panel_create_item (MainPanel, PANEL_SLIDER
- X , PANEL_CLIENT_DATA, (caddr_t) Game
- X , PANEL_NOTIFY_PROC, HandicapProc
- X , PANEL_MAX_VALUE, MaxHandicap
- X , PANEL_VALUE, Game->Handicap
- X , PANEL_LAYOUT, PANEL_VERTICAL
- X , PANEL_LABEL_STRING, "Handicap: "
- X , PANEL_PAINT, PANEL_NONE
- X , 0); /* Remove PANEL_PAINT line in 3.0. */
- X NameButton= panel_create_item (MainPanel, PANEL_TEXT
- X , PANEL_CLIENT_DATA, (caddr_t) Game
- X , PANEL_VALUE, GameName
- X , PANEL_VALUE_DISPLAY_LENGTH, 16
- X , PANEL_LABEL_STRING, "Game: "
- X , 0);
- X Junk= panel_create_item (MainPanel, PANEL_BUTTON
- X , PANEL_CLIENT_DATA, (caddr_t) NameButton
- X , PANEL_NOTIFY_PROC, ReadGameProc
- X , PANEL_VALUE, GameName
- X , PANEL_LABEL_IMAGE,
- X panel_button_image (MainPanel, "Read Game", 11, NullFont)
- X , 0);
- X Junk= panel_create_item (MainPanel, PANEL_BUTTON
- X , PANEL_CLIENT_DATA, (caddr_t) NameButton
- X , PANEL_NOTIFY_PROC, PrintProc
- X , PANEL_VALUE, GameName
- X , PANEL_LABEL_IMAGE
- X , panel_button_image (MainPanel, "Print", 7, NullFont)
- X , 0);
- X Junk= panel_create_item (MainPanel, PANEL_BUTTON
- X , PANEL_CLIENT_DATA, (caddr_t) NameButton
- X , PANEL_VALUE, GameName
- X , PANEL_NOTIFY_PROC, WriteGameProc
- X , PANEL_LABEL_IMAGE,
- X panel_button_image (MainPanel, "Write Game", 12, NullFont)
- X , 0);
- X Junk= panel_create_item (MainPanel, PANEL_BUTTON
- X , PANEL_CLIENT_DATA, (caddr_t) NameButton
- X , PANEL_VALUE, GameName
- X , PANEL_NOTIFY_PROC, WriteBoardProc
- X , PANEL_LABEL_IMAGE,
- X panel_button_image (MainPanel, "Write Board", 13, NullFont)
- X , 0);
- X Junk= panel_create_item (MainPanel, PANEL_CHOICE
- X , PANEL_CLIENT_DATA, (caddr_t) Game
- X , PANEL_NOTIFY_PROC, VerboseNotify
- X , PANEL_CHOICE_STRINGS, "Verbose", "Silent", 0
- X , PANEL_VALUE, Verbose
- X , PANEL_DISPLAY_LEVEL, PANEL_CURRENT
- X , 0);
- X Junk= panel_create_item (MainPanel, PANEL_BUTTON
- X , PANEL_CLIENT_DATA, (caddr_t) Game
- X , PANEL_NOTIFY_PROC, CloseProc
- X , PANEL_LABEL_IMAGE
- X , panel_button_image (MainPanel, "Close", 7, NullFont)
- X , 0);
- X Junk= panel_create_item (MainPanel, PANEL_BUTTON
- X , PANEL_CLIENT_DATA, (caddr_t) Game
- X , PANEL_NOTIFY_PROC, Quit
- X , PANEL_LABEL_IMAGE, panel_button_image (MainPanel, "Quit", 6, NullFont)
- X , 0);
- X Junk= panel_create_item (MainPanel, PANEL_BUTTON
- X , PANEL_CLIENT_DATA, (caddr_t) Game
- X , PANEL_NOTIFY_PROC, ResetProc
- X , PANEL_LABEL_IMAGE
- X , panel_button_image (MainPanel, "Reset", 7, NullFont)
- X , 0);
- X MsgPanelItem= panel_create_item (MsgSW, PANEL_MESSAGE
- X , PANEL_LABEL_STRING, StdMessage, 0);
- X StatusPanelItem= panel_create_item (StatusSW, PANEL_MESSAGE, 0);
- X} /* InitPanel */
- X
- X
- XLabelToPanel (m)
- X MoveType *m;
- X{
- Xchar *c;
- X if (m == NULL) c= " ";
- X else c= m->Label;
- X panel_set (LabelButton, PANEL_VALUE, c, 0);
- X} /* LabelToPanel */
- X
- X
- XLeafwardNotify (PI, event)
- X Panel_item PI;
- X Event *event;
- X{
- XGameType *Game;
- XMoveType *Move;
- X Game= (GameType *) panel_get (PI, PANEL_CLIENT_DATA);
- X if (UserTextMods) SaveText (Game);
- X Step (Game, 0);
- X if (Game->CurrMove == NULL) return;
- X for (Move= Game->CurrMove->Next; Move != NULL; Move= Move->Next) {
- X if (Move->AltNext != Move) break;
- X Step (Game, 0);
- X }
- X Replay (Game, 1);
- X} /* LeafwardNotify */
- X
- X
- X Panel_setting
- XMoveLabelNotify (PI, GoEvent)
- X Panel_item PI;
- X Event *GoEvent;
- X{
- XGameType *Game;
- Xchar c, s [2];
- X Game= (GameType *) panel_get (PI, PANEL_CLIENT_DATA);
- X if (Game->CurrMove != NULL) {
- X c= event_id (GoEvent);
- X s[0]= c;
- X s[1]= '\0';
- X if ((c == '\127') || (c == '\010')) c= '\0'; /* del or back-space */
- X if ((c == '\0')
- X || ((c >= 'a') && (c <= 'z'))
- X || ((c >= 'A') && (c <= 'Z')))
- X panel_set_value (PI, s);
- X PanelToLabel (Game->CurrMove->Next);
- X DrawAlts (Game, Game->CurrMove);
- X }
- X return panel_text_notify (PI, GoEvent);
- X} /* MoveLabelNotify */
- X
- X
- XMsg (MsgString)
- X char *MsgString;
- X{
- X panel_set (MsgPanelItem, PANEL_LABEL_STRING, MsgString, 0);
- X} /* MsgString */
- X
- X
- XPanelToLabel (m)
- X MoveType *m;
- X{
- X#ifdef LABEL_BUTTON
- Xchar *s;
- X if (m == NULL) return;
- X s= (char *) panel_get (LabelButton, PANEL_VALUE);
- X/* printf ("PL %s: %s\n", s, m->Note);
- X*/
- X m->Label [0]= *s;
- X m->Label [1]= '\0';
- X#endif LABEL_BUTTON
- X} /* PanelToLabel */
- X
- X
- XPassProc (PI, GoEvent)
- X Panel_item PI;
- X struct inputevent *GoEvent;
- X/* Allows a player to pass on a move. */
- X{
- XGameType *Game;
- X Game= (GameType *) panel_get (PI, PANEL_CLIENT_DATA);
- X if (EnterMove (-1, -1, Game, 1, PassAction)) StatusMsg ("Unable to pass.");
- X} /* PassProc */
- X
- X
- XPlaceMoveProc (PI, GoEvent)
- X Panel_item PI;
- X struct inputevent *GoEvent;
- X/* Toggles Placing or Moving state and Panel button. */
- X{
- XGameType *Game;
- X Game= (GameType *) panel_get (PI, PANEL_CLIENT_DATA);
- X if (Game->Placing == 0) {
- X if (Game->MoveNum == 0) {
- X Game->Placing= 1;
- X panel_set_value (PlaceMoveButton, 0);
- X }
- X } else {
- X Game->Placing= 0;
- X panel_set_value (PlaceMoveButton, 1);
- X }
- X} /* PlaceMoveProc */
- X
- X
- XPrintProc (PI, GoEvent)
- X Panel_item PI;
- X struct inputevent *GoEvent;
- X{
- XGameType *Game;
- X PI= panel_get (PI, PANEL_CLIENT_DATA);
- X Game= (GameType *) panel_get (PI, PANEL_CLIENT_DATA);
- X PrintBoard (Game);
- X} /* PrintProc */
- X
- X
- XPruneProc (PI, GoEvent)
- X Panel_item PI;
- X struct inputevent *GoEvent;
- X{
- XGameType *Game;
- XMoveType *m, *m1;
- Xint Count;
- X Game= (GameType *) panel_get (PI, PANEL_CLIENT_DATA);
- X m= Game->CurrMove;
- X if (m == NULL) return;
- X if (m->AltNext == m) {
- X if (m->Prev) m->Prev->Next= NULL;
- X else Game->MoveList= NULL;
- X } else {
- X if (!m->Prev) {
- X Game->MoveList= m->AltNext;
- X } else {
- X m->Prev->Next= m->AltNext;
- X }
- X if (m->AltNext->AltNext == m) {
- X m->AltNext->Label [0]= ' ';
- X } else {
- X for (m1= m->AltNext, Count= 0; m1 != m; m1= m1->AltNext)
- X m1->Label [0]= 'a' + Count++;
- X }
- X m->AltNext->AltPrev= m->AltPrev;
- X m->AltPrev->AltNext= m->AltNext;
- X }
- X m->AltNext= NULL;
- X m->AltPrev= NULL;
- X Backup (Game, 1);
- X FreeMoves (m);
- X Step (Game, 1);
- X} /* PruneProc */
- X
- X
- XQuit (PI, GoEvent)
- X Panel_item PI;
- X struct inputevent *GoEvent;
- X{
- X if (Confirm ()) exit (0);
- X} /* Quit */
- X
- X
- XReadGameProc (PI, GoEvent)
- X Panel_item PI;
- X struct inputevent *GoEvent;
- X/* Notified by panel. */
- X{
- XGameType *Game;
- X if (Confirm ()) {
- X PI= panel_get (PI, PANEL_CLIENT_DATA);
- X Game= (GameType *) panel_get (PI, PANEL_CLIENT_DATA);
- X if (ReadGame (panel_get_value (PI), Game, PANEL_CLEAR)) {
- X StatusMsg ("Can't read file.");
- X return;
- X }
- X Replay (Game, 1);
- X Status (Game);
- X }
- X} /* ReadGameProc */
- X
- X
- XReplayProc (PI, GoEvent)
- X Panel_item PI;
- X struct inputevent *GoEvent;
- X{
- XGameType *Game;
- X Game= (GameType *) panel_get (PI, PANEL_CLIENT_DATA);
- X Replay (Game, 1); /* Recompute board. */
- X} /* ReplayProc */
- X
- X
- XResetProc (PI, GoEvent)
- X Panel_item PI;
- X struct inputevent *GoEvent;
- X/* Resets (clears) game. */
- X{
- Xstruct rect *r;
- XGameType *Game;
- X if (Confirm ()) {
- X Game= (GameType *) panel_get (PI, PANEL_CLIENT_DATA);
- X r= (struct rect *) window_get (BoardSW, WIN_RECT);
- X pw_writebackground (BoardPW, 0, 0, r->r_width, r->r_height, PIX_CLR);
- X ZeroGame (Game, PANEL_CLEAR);
- X HandicapBoard (Game);
- X/*
- X DrawGameInit (Game, r->r_width, r->r_height);
- X*/
- X DrawGame (Game, 0);
- X }
- X} /* ResetProc */
- X
- X
- XRootwardNotify (PI, event)
- X Panel_item PI;
- X Event *event;
- X{
- XGameType *Game;
- XMoveType *Move;
- X Game= (GameType *) panel_get (PI, PANEL_CLIENT_DATA);
- X if (UserTextMods) SaveText (Game);
- X Backup (Game, 0);
- X if (Game->CurrMove == NULL) return;
- X for (Move= Game->CurrMove; Move != NULL; Move= Move->Prev) {
- X if (Move->Next->AltNext != Move->Next) break;
- X Backup (Game, 0);
- X }
- X Replay (Game, 1);
- X} /* RootwardNotify */
- X
- X
- XSetCurrMove (PI, Value, GoEvent)
- X Panel_item PI;
- X unsigned int Value;
- X struct inputevent *GoEvent;
- X{
- XMoveType *m;
- Xint k;
- XGameType *Game;
- X Game= (GameType *) panel_get (PI, PANEL_CLIENT_DATA);
- X if (Value > Game->NumMoves) Game->MoveNum= Game->NumMoves;
- X else Game->MoveNum= Value;
- X for (m= Game->MoveList, k= 1; m != NULL; m= m->Next) {
- X /* Find move corresponding to MoveNum. */
- X/*
- X if (m->Next == NULL) break;
- X if (k >= Game->MoveNum) break;
- X k++;
- X*/
- X }
- X if (Game->MoveNum == 0) Game->CurrMove= NULL;
- X else Game->CurrMove= m;
- X Replay (Game, 1);
- X Status (Game);
- X} /* SetCurrMove */
- X
- X
- XSetFirstPlayerButton (s, ShouldPaint)
- X Stone s;
- X Panel_setting ShouldPaint;
- X{
- X if (s == Black)
- X panel_set (FirstPlayerButton, PANEL_VALUE, 0
- X , PANEL_PAINT, ShouldPaint, 0);
- X else
- X panel_set (FirstPlayerButton, PANEL_VALUE, 1
- X , PANEL_PAINT, ShouldPaint, 0);
- X} /* SetFirstPlayerButton */
- X
- X
- XStatus (Game)
- X GameType *Game;
- X{
- Xchar MsgString [80];
- Xchar AltMsg [30];
- Xint i;
- XMoveType *m;
- X panel_set (CurrMoveSlider, PANEL_VALUE, Game->MoveNum, 0);
- X for (m= Game->CurrMove, i= 1; m != NULL; m= m->AltNext) {
- X if (m->AltNext == Game->CurrMove) break;
- X i++;
- X }
- X if (i > 1) sprintf (AltMsg, "%d Alternates. ", i);
- X else AltMsg [0]= '\0';
- X sprintf (MsgString
- X , "%sWhite stones captured %d, Black stones captured %d.\n"
- X , AltMsg
- X , Game->Prisoners [White], Game->Prisoners [Black]);
- X StatusMsg (MsgString);
- X} /* Status */
- X
- X
- XStatusMsg (MsgString)
- X char *MsgString;
- X/* Status message in panel message subwindow. */
- X{
- X panel_set (StatusPanelItem, PANEL_LABEL_STRING, MsgString, 0);
- X} /* StatusMsg */
- X
- X
- XStdMsg ()
- X/* Standard message in panel message subwindow. */
- X{
- X Msg (StdMessage);
- X} /* StdMsg */
- X
- X
- XVerboseNotify (PI, Value, GoEvent)
- X Panel_item PI;
- X int Value;
- X Event *GoEvent;
- X{
- XGameType *Game;
- Xint i, j;
- X Game= (GameType *) panel_get (PI, PANEL_CLIENT_DATA);
- X Verbose= Value;
- X if (Verbose) {
- X if (Game->CurrMove) {
- X HighlightMove (Game, Game->CurrMove, -1, -1);
- X if (Game->CurrMove->Next) DrawAlts (Game, Game->CurrMove);
- X }
- X textsw_normalize_view (TextSW, 0);
- X } else {
- X if (Game->CurrMove) {
- X if (Game->CurrMove->Next) DrawAltsEmpty (Game, Game->CurrMove);
- X i= Game->CurrMove->i; /* Unhighlight currmove. */
- X j= Game->CurrMove->j;
- X UnHighlightMove (Game, i, j);
- X }
- X textsw_normalize_view (TextSW, TEXTSW_INFINITY);
- X }
- X} /* VerboseNotify */
- X
- X
- XWriteBoardProc (PI, GoEvent)
- X Panel_item PI;
- X struct inputevent *GoEvent;
- X/* Notified by panel. */
- X{
- XGameType *Game;
- X if (Confirm ()) {
- X PI= panel_get (PI, PANEL_CLIENT_DATA);
- X Game= (GameType *) panel_get (PI, PANEL_CLIENT_DATA);
- X if (WriteBoard (panel_get_value (PI), Game))
- X StatusMsg ("Can't create file.");
- X }
- X} /* WriteBoardProc */
- X
- X
- XWriteGameProc (PI, GoEvent)
- X Panel_item PI;
- X struct inputevent *GoEvent;
- X/* Notified by panel. */
- X{
- XGameType *Game;
- X if (Confirm ()) {
- X PI= panel_get (PI, PANEL_CLIENT_DATA);
- X Game= (GameType *) panel_get (PI, PANEL_CLIENT_DATA);
- X if (UserTextMods) SaveText (Game);
- X if (WriteGame (panel_get_value (PI), Game))
- X StatusMsg ("Can't create file.");
- X }
- X} /* WriteGameProc */
- END_OF_FILE
- if test 17631 -ne `wc -c <'gopanel.c'`; then
- echo shar: \"'gopanel.c'\" unpacked with wrong size!
- fi
- # end of 'gopanel.c'
- fi
- if test -f 'goprint.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'goprint.c'\"
- else
- echo shar: Extracting \"'goprint.c'\" \(5030 characters\)
- sed "s/^X//" >'goprint.c' <<'END_OF_FILE'
- X#ifndef lint
- Xstatic char sccsid[]= "@(#)goprint.c 1.3 87/01/11 Copyr 1986 Sun Micro";
- X#endif
- X
- X/* Copyright (c) Sun MicroSystems, 1985. This code may be used and modified
- X for not-for-profit use. This notice must be retained. */
- X
- X
- X#include "goban.h"
- X#include <setjmp.h>
- X
- Xjmp_buf LWEnvironment;
- X
- X
- XPrintBoard (Game)
- X GameType *Game;
- X/* Print board large. */
- X{
- XFILE *f;
- Xint i, j, k, LastLine;
- XMoveType *Move;
- Xint Diam; /* Diameter of a stone. */
- Xint Units; /* Units per inch. */
- Xint FontPts;
- Xint BrdMargin, Margin, PageWidth;
- XStone s;
- X LastLine= Game->Grid - 1;
- X Units= 72; /* Pts. per inch. */
- X FontPts= 12;
- X BrdMargin= (int) (1.5 * Units);
- X Margin= Units;
- X PageWidth= (int) (8.5 * Units);
- X Diam= ((int) (Units * 5.5)) / LastLine;
- X if (setjmp (LWEnvironment)) {
- X StatusMsg ("SigPipe: Couldn't find laser printer (lpr -Plw).\n");
- X return 1;
- X } else {
- X f= popen ("lpr -Plw", "w");
- X if (f == (FILE *) NULL) {
- X StatusMsg ("popen: Couldn't find laser printer (lpr -Plw).\n");
- X return 1;
- X }
- X fprintf (f, "%%!\n"); /* Tell lpr to pass commands to postscript. */
- X fprintf (f
- X , "/cshow { dup stringwidth exch 2 div neg exch rmoveto show } def\n");
- X fprintf (f, "(Times-Roman) findfont %d scalefont setfont\n", FontPts);
- X for (i= 0; i < Game->Grid; i++) {
- X fprintf (f, "%d %d moveto %d %d lineto stroke\n"
- X , BrdMargin + i * Diam, BrdMargin
- X , BrdMargin + i * Diam, BrdMargin + LastLine * Diam);
- X fprintf (f, "%d %d moveto %d %d lineto stroke\n"
- X , BrdMargin, BrdMargin + i * Diam
- X , BrdMargin + LastLine * Diam, BrdMargin + i * Diam);
- X fprintf (f, "%d %d moveto (%c) show\n"
- X , BrdMargin + i * Diam - FontPts / 2, Margin
- X , (i < 8) ? ('A' + i) : ('B' + i));
- X fprintf (f, "%d %d moveto (%c) show\n"
- X , BrdMargin + i * Diam - FontPts / 2
- X , PageWidth - Margin
- X , (i < 8) ? ('A' + i) : ('B' + i));
- X fprintf (f, "%d %d moveto (%d) show\n"
- X , Margin, BrdMargin + i * Diam - FontPts / 2, i + 1);
- X fprintf (f, "%d %d moveto (%d) show\n", PageWidth - Margin
- X , BrdMargin + i * Diam - FontPts / 2, i + 1);
- X }
- X if (Game->Grid == 19) {
- X for (i= 0; i < 3; i++) {
- X for (j= 0; j < 3; j++) {
- X fprintf (f, "newpath %d %d %d 0 360 arc fill\n"
- X , BrdMargin + (3 + i * 6) * Diam
- X , BrdMargin + (3 + j * 6) * Diam, 3);
- X }
- X }
- X }
- X fprintf (f, "newpath\n");
- X for (i= 0; i < Game->Grid; i++) {
- X for (j= 0; j < Game->Grid; j++) {
- X if (Game->InitialBoard [i][j] != Empty) {
- X fprintf (f, "%d %d %d 0 360 arc fill\n", BrdMargin + i *Diam
- X , BrdMargin + j * Diam, Diam / 2 - Units / 72);
- X if (Game->InitialBoard [i][j] == White) {
- X fprintf (f, "1 setgray %d %d %d 0 360 arc fill\n"
- X , BrdMargin + i * Diam, BrdMargin + j * Diam
- X , Diam / 2 - Units / 36);
- X fprintf (f, "0 setgray\n");
- X }
- X }
- X }
- X }
- X if (Game->MoveNum < 10) FontPts= 12;
- X else if (Game->MoveNum < 100) FontPts= 10;
- X else FontPts= 8;
- X fprintf (f, "(Times-Roman) findfont %d scalefont setfont\n", FontPts);
- X FontPts= FontPts / 3;
- X s= Game->FirstPlayer;
- X for (k= 0, Move= Game->MoveList; (k < Game->MoveNum) && (Move!=NULL)
- X ; k++){
- X i= Move->i;
- X j= Move->j;
- X if (i >= 0) {
- X if (Game->Board [i] [j] == Empty) {
- X fprintf (f, "newpath 1 setgray %d %d %d 0 360 arc fill\n"
- X , BrdMargin + i * Diam, BrdMargin + j * Diam
- X , Diam / 2 - Units / 36);
- X fprintf (f, "0 setgray\n");
- X fprintf (f, "%d %d moveto (%d) cshow\n"
- X , BrdMargin + i * Diam, BrdMargin + j * Diam - FontPts
- X , k + 1);
- X } else {
- X fprintf (f, "newpath %d %d %d 0 360 arc fill\n"
- X , BrdMargin + i * Diam, BrdMargin + j * Diam
- X , Diam / 2 - Units / 72);
- X if (Game->Board [i] [j] == White) {
- X fprintf (f, "1 setgray %d %d %d 0 360 arc fill\n"
- X , BrdMargin + i * Diam, BrdMargin + j * Diam
- X , Diam / 2 - Units / 36);
- X fprintf (f, "0 setgray\n");
- X fprintf (f, "%d %d moveto (%d) cshow\n"
- X , BrdMargin + i * Diam
- X , BrdMargin + j * Diam - FontPts
- X , k + 1);
- X } else {
- X fprintf (f, "1 setgray %d %d moveto (%d) cshow\n"
- X , BrdMargin + i * Diam
- X , BrdMargin + j * Diam - FontPts
- X , k + 1);
- X fprintf (f, "0 setgray\n");
- X }
- X }
- X }
- X s= !s;
- X Move= Move->Next;
- X }
- X }
- X fprintf (f, "(Times-Roman) findfont %d scalefont setfont\n", 18);
- X fprintf (f, "%d %d moveto (%s) show\n", Margin, PageWidth + Margin
- X , Game->Title);
- X if (Game->MoveNum & 1) s= !Game->FirstPlayer;
- X else s= Game->FirstPlayer;
- X fprintf (f, "%d %d moveto (%s to move.) show\n"
- X , Margin, PageWidth + Margin/2, (s == Black) ? "Black" : "White");
- X fprintf (f, "%d %d moveto\n", Margin, PageWidth);
- X fprintf (f, "(White stones captured: %d, Black stones captured: %d.)"
- X , Game->Prisoners [White], Game->Prisoners [Black]);
- X fprintf (f, " show\n");
- X fprintf (f, "showpage\n"); /* Tell postscript to print. */
- X#ifdef DEBUG
- X#else
- X pclose (f);
- X#endif
- X return 0;
- X} /* PrintBoard */
- X
- X
- XSigPipe ()
- X/* Take care of broken pipe from lpr -Plw. */
- X{
- X longjmp (LWEnvironment, 1);
- X} /* SigPipe */
- END_OF_FILE
- if test 5030 -ne `wc -c <'goprint.c'`; then
- echo shar: \"'goprint.c'\" unpacked with wrong size!
- fi
- # end of 'goprint.c'
- fi
- if test -f 'goservice.c' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'goservice.c'\"
- else
- echo shar: Extracting \"'goservice.c'\" \(16823 characters\)
- sed "s/^X//" >'goservice.c' <<'END_OF_FILE'
- X#ifndef lint
- Xstatic char sccsid[]= "@(#)goservice.c 1.3 87/01/11 Copyr 1986 Sun Micro";
- X#endif
- X
- X/* Copyright (c) Sun MicroSystems, 1986. This code may be used and modified
- X for not-for-profit use. This notice must be retained. */
- X
- X#include "goban.h"
- X#include <suntool/panel.h>
- X
- XMoveType *TrashMoves;
- XCaptureType *TrashCaptures;
- XGroupType *TrashGroups;
- X
- Xextern Panel_item CurrMoveSlider, HandicapSlider, NameButton;
- X
- X
- X CaptureType *
- XAllocCapture (i, j)
- X int i, j;
- X{
- XCaptureType *c;
- X if (TrashCaptures != NULL) {
- X c= TrashCaptures;
- X TrashCaptures= TrashCaptures->Next;
- X } else {
- X c= Malloc (CaptureType);
- X }
- X c->Next= NULL;
- X c->i= i;
- X c->j= j;
- X return c;
- X} /* AllocCapture */
- X
- X
- X GroupType *
- XAllocGroup (Color, Libs, NumStones)
- X int Color, Libs, NumStones;
- X{
- XGroupType *g;
- X if (TrashGroups != NULL) {
- X g= TrashGroups;
- X TrashGroups= TrashGroups->Next;
- X } else {
- X g= Malloc (GroupType);
- X }
- X g->Color= Color;
- X g->NumLibs= Libs;
- X g->NumStones= NumStones;
- X g->Next= NULL;
- X return g;
- X} /* AllocGroup */
- X
- X
- X MoveType *
- XAllocMove (i, j, CurrMove)
- X int i, j;
- X MoveType *CurrMove;
- X{
- XMoveType *m;
- X if (TrashMoves != NULL) {
- X m= TrashMoves;
- X TrashMoves= TrashMoves->Next;
- X } else {
- X m= Malloc (MoveType);
- X }
- X m->Next= NULL;
- X m->Prev= CurrMove;
- X m->AltNext= m;
- X m->AltPrev= m;
- X m->Label [0]= ' ';
- X m->Label [1]= '\0';
- X m->Note= NULL;
- X if (CurrMove != NULL) CurrMove->Next= m;
- X m->Captures= NULL;
- X m->i= i;
- X m->j= j;
- X return m;
- X} /* AllocMove */
- X
- X
- XCafard (s) /* French for cockroach */
- X char *s;
- X{
- X fprintf (stderr, s);
- X exit (1);
- X} /* Cafard */
- X
- X
- XFreeCaptures (c)
- X CaptureType *c;
- X/* Free capture c and all succeeding captures in its list by moving into
- X TrashCaptures.
- X*/
- X{
- XCaptureType *c1;
- X if (c == NULL) return;
- X for (c1= c; c->Next != NULL; c= c->Next); /* Go to end of list. */
- X c->Next= TrashCaptures;
- X TrashCaptures= c1;
- X} /* FreeCaptures */
- X
- X
- XFreeGroup (g)
- X GroupType *g;
- X{
- XGroupType *t;
- X if (g == NULL) return;
- X for (t= TrashGroups; t != NULL; t= t->Next)
- X if (g == t) return;
- X g->Next= TrashGroups;
- X TrashGroups= g;
- X} /* FreeGroup */
- X
- X
- XFreeMoves (m)
- X MoveType *m;
- X/* Free move m and all succeeding moves in its list by moving into TrashMoves.
- X Trim off and free all side trees descending from m.
- X*/
- X{
- XMoveType *m1, *m2;
- X if (m == NULL) return;
- X FreeCaptures (m->Captures);
- X if (m->Note != NULL) {
- X free (m->Note);
- X m->Note= NULL;
- X }
- X for (m1= m->Next; m1 != NULL; m1= m2) {
- X m2= m1->AltNext;
- X FreeMoves (m1);
- X if (m1->AltPrev != NULL) m1->AltPrev->AltNext= NULL;
- X if (m1->AltNext != NULL) m1->AltNext->AltPrev= NULL;
- X if (m2 == m->Next) break;
- X }
- X m->Next= TrashMoves;
- X TrashMoves= m;
- X} /* FreeMoves */
- X
- X
- XGetComment (F, String, ReturnedString)
- X FILE *F;
- X char *String, **ReturnedString;
- X{
- X#define MaxBuf 1024
- Xint NumChars, Quit;
- Xchar Buf [MaxBuf], *s, *b;
- X s= String + 2;
- X while (*s == ' ') s++;
- X b= Buf;
- X Buf [0]= '\0';
- X Quit= 0;
- X while (*s != '\0') {
- X if ((*s == '*') && (*(s+1) == '/')) {
- X *b++= '\0';
- X Quit= 1;
- X break;
- X }
- X *b++= *s++;
- X }
- X if (!Quit) {
- X while ((b - Buf) < MaxBuf) {
- X *b= getc (F);
- X if (*b == '/') {
- X if (*(b-1) == '*') {
- X *(b-1)= '\0';
- X b--;
- X break;
- X }
- X }
- X b++;
- X }
- X }
- X while ((b >= Buf) && (*b == ' ')) {
- X *b--= '\0';
- X }
- X if (Buf [0] != '\0') {
- X NumChars= b- Buf;
- X s= *ReturnedString= (char *) malloc (NumChars + 1);
- X for (b= Buf; NumChars > 0; NumChars--) *s++= *b++;
- X *s= '\0';
- X }
- X if (EOF == fscanf (F, "%s", String)) return 1;
- X else return 0;
- X#undef MaxBuf
- X} /* GetComment */
- X
- X
- XHandicapBoard (Game)
- X GameType *Game;
- X/* Set Handicap points on board to black. */
- X{
- Xint i, j;
- X switch (Game->Handicap) {
- X default: printf ("Handicap (%d) larger than 17.\n", Game->Handicap);
- X Game->Handicap= 17;
- X case 17: Game->InitialBoard [ 6] [12]= Black;
- X case 16: Game->InitialBoard [12] [ 6]= Black;
- X case 15: Game->InitialBoard [ 6] [ 6]= Black;
- X case 14: Game->InitialBoard [12] [12]= Black;
- X case 13: Game->InitialBoard [ 2] [16]= Black;
- X case 12: Game->InitialBoard [16] [ 2]= Black;
- X case 11: Game->InitialBoard [ 2] [ 2]= Black;
- X case 10: Game->InitialBoard [16] [16]= Black;
- X case 9: Game->InitialBoard [ 9] [ 9]= Black;
- X case 8: Game->InitialBoard [ 9] [15]= Black;
- X case 7: if (Game->Handicap == 7) Game->InitialBoard [9] [9]= Black;
- X else Game->InitialBoard [9] [3]= Black;
- X case 6: Game->InitialBoard [3] [9]= Black;
- X case 5: if (Game->Handicap == 5) Game->InitialBoard [9] [9]= Black;
- X else Game->InitialBoard [15] [9]= Black;
- X case 4: Game->InitialBoard [ 3] [15]= Black;
- X case 3: Game->InitialBoard [15] [ 3]= Black;
- X case 2: Game->InitialBoard [ 3] [ 3]= Black;
- X case 1: Game->InitialBoard [15] [15]= Black;
- X case 0: break;
- X } /*switch*/
- X for (i= 0; i < MaxGrid; i++)
- X for (j= 0; j < MaxGrid; j++) {
- X Game->Board [i] [j]= Game->InitialBoard [i] [j];
- X if (Game->InitialBoard [i] [j] != Empty) {
- X if (Game->Groups [i][j] != NULL)
- X FreeGroup (Game->Groups [i][j]);
- X Game->Groups [i] [j]=
- X AllocGroup (Game->InitialBoard [i] [j], 4, 1);
- X }
- X }
- X} /* HandicapBoard */
- X
- X
- X char *
- XPositionToString (i, j, String, Depth)
- X int i, j;
- X char String [];
- X int Depth; /* level of tree. */
- X/* Write into a char array a string consisting of
- X <depth>."pass" or
- X <depth>.<letter><one or two digits><newline>.
- X If Depth == 0 ignore it.
- X*/
- X{
- X if (Depth == 0) {
- X if (i >= 0)
- X sprintf (String, "%c%d", 'A' + ((i > 7) ? (i + 1) : i), j + 1);
- X else sprintf (String, "%s", "pass");
- X } else {
- X if (i >= 0)
- X sprintf (String, "%d.%c%d"
- X , Depth, 'A' + ((i > 7) ? (i + 1) : i), j + 1);
- X else sprintf (String, "%d.%s", Depth, "pass");
- X }
- X return String;
- X} /* PositionToString */
- X
- X
- XReadGame (GameName, Game, ShouldPaint)
- X char *GameName;
- X GameType *Game;
- X Panel_setting ShouldPaint;
- X{
- XFILE *F;
- Xint i, j, NumCaptures, Depth;
- Xchar String [40];
- Xchar Err [80];
- XStone Color;
- XMoveType *Move, *m;
- X if (NULL == (F= fopen (GameName, "r", 0))) return 1;
- X ZeroGame (Game, ShouldPaint);
- X strncpy (Game->Title, GameName, MaxTitleChars-1);
- X fscanf (F, "%s", String); /* Size of board. */
- X if ((String [0] == '/') && (String [1] == '*')) {
- X GetComment (F, String, &(Game->Note));
- X }
- X Game->Grid= atoi (String);
- X fscanf (F, "%s", String); /* Handicap. */
- X Game->Handicap= atoi (String);
- X if (Game->Handicap == 0) { /* Initial board position from file. */
- X for (;;) {
- X fscanf (F, "%s", String);
- X if (String [0] == '.') break;
- X StringToPosition (String, &i, &j, &Depth);
- X Game->InitialBoard [i] [j]= Black;
- X }
- X for (;;) {
- X fscanf (F, "%s", String);
- X if (String [0] == '.') break;
- X StringToPosition (String, &i, &j, &Depth);
- X Game->InitialBoard [i] [j]= White;
- X }
- X for (i= 0; i < Game->Grid; i++)
- X for (j= 0; j < Game->Grid; j++) {
- X Game->Board [i] [j]= Game->InitialBoard [i] [j];
- X }
- X } else { /* Initial board position automatic. */
- X HandicapBoard (Game);
- X }
- X if (EOF == fscanf (F, "%s", String))
- X Cafard ("Unexpected end of file after handicap or initial board.\n");
- X if (String [0] == 'B') Game->FirstPlayer= Black;
- X else if (String [0] == 'W') Game->FirstPlayer= White;
- X for (Game->MoveNum= 0; ;) {
- X if (EOF == fscanf (F, "%s", String)) break;
- X if (String [0] == '|') {
- X SetLabel (Move, String + 1);
- X if (EOF == fscanf (F, "%s", String)) break;
- X }
- X if ((String [0] == '/') && (String [1] == '*')) {
- X if (GetComment (F, String, &(Move->Note))) break;
- X }
- X StringToPosition (String, &i, &j, &Depth);
- X Depth--;
- X if ((Depth >= 0) && (Game->MoveNum != Depth)) {
- X if (Depth > Game->MoveNum) {
- X sprintf (Err,"Moves out of order: too deep. \"%s\".\n",String);
- X Cafard (Err);
- X }
- X while (Depth < Game->MoveNum) {
- X Move= Move->Prev;
- X Backup (Game, 0);
- X }
- X /* Install as alternate branch. */
- X if (Move != NULL) {
- X m= AllocMove (i, j, (MoveType *) NULL);
- X m->Prev= Move;
- X m->AltPrev= Move->Next->AltPrev;
- X Move->Next->AltPrev= m;
- X m->AltNext= Move->Next;
- X m->AltPrev->AltNext= m;
- X Move= m;
- X } else {
- X m= AllocMove (i, j, (MoveType *) NULL);
- X m->AltNext= Game->MoveList;
- X m->AltPrev= Game->MoveList->AltPrev;
- X m->AltPrev->AltNext= m;
- X Game->MoveList->AltPrev= m;
- X Move= m;
- X }
- X } else {
- X if (Game->MoveList == NULL) {
- X Game->MoveList= Move= AllocMove (i, j, (MoveType *) NULL);
- X } else {
- X Move->Next= AllocMove (i, j, Move);
- X Move= Move->Next;
- X }
- X }
- X Game->CurrMove= Move;
- X if (i >= 0) {
- X Game->Board [i] [j]= Color=
- X (Game->MoveNum & 1) ? !Game->FirstPlayer : Game->FirstPlayer;
- X NewStoneToGroups (Game, i, j);
- X NumCaptures= GenCaptures (Game, !Color, Move);
- X }
- X if (++Game->MoveNum > Game->NumMoves) Game->NumMoves= Game->MoveNum;
- X }
- X for (Move= Game->MoveList, Game->MoveNum= 0; Move != NULL; Move=Move->Next){
- X Game->MoveNum++;
- X }
- X Color= (Game->MoveNum & 1) ? !Game->FirstPlayer : Game->FirstPlayer;
- X SetFirstPlayerButton (Color, ShouldPaint);
- X panel_set (CurrMoveSlider
- X , PANEL_MAX_VALUE, Game->NumMoves
- X , PANEL_VALUE, Game->MoveNum
- X , PANEL_PAINT, ShouldPaint, 0);
- X panel_set (HandicapSlider, PANEL_VALUE, Game->Handicap
- X , PANEL_PAINT, ShouldPaint, 0);
- X if (Game->MoveList != NULL) Game->CurrMove= Move;
- X return 0;
- X} /* ReadGame */
- X
- X
- XSetFirst (Game, s, ShouldPaint)
- X GameType *Game;
- X Stone s;
- X Panel_setting ShouldPaint;
- X/* Set first player of game. */
- X{
- X Game->FirstPlayer= s;
- X SetFirstPlayerButton (s, ShouldPaint);
- X} /* SetFirst */
- X
- X
- XSetLabel (m, s)
- X MoveType *m;
- X char *s;
- X{
- X m->Label [0]= *s;
- X m->Label [1]= '\0';
- X} /* SetLabel */
- X
- X
- X
- XStringToPosition (String, i, j, Depth)
- X char String [];
- X int *i, *j, *Depth;
- X/* Parses string of form <letter><one or two digits> and leaves
- X corresponding position in i and j. The string may be prepended
- X with <depth><period>.
- X */
- X{
- Xchar Err [80];
- Xchar *s;
- X *Depth= 0;
- X *i= -1;
- X *j= -1;
- X s= String;
- X if ((*s >= '0') && (*s <= '9')) {
- X while ((*s >= '0') && (*s <= '9')) { /* Initial depth? */
- X *Depth= *Depth * 10 + *s++ - '0';
- X }
- X if (*s++ != '.') *Depth= -1; /* Alert error routine. */
- X }
- X if ((0 == strncmp (s, "pass", 4)) && (*(s + 4) == '\0')) {
- X return 0; /* OK */
- X }
- X if (*s > 'I') (*s)--;
- X *i= *s - 'A';
- X if (*(s+2) != '\0') *j= 10 + *(s+2) - '1';
- X else *j= *(s+1) - '1';
- X if ((*Depth<0) || (*i<0) || (*i >=MaxGrid) || (*j < 0) || (*j >= MaxGrid)) {
- X sprintf (Err, "Bad position %s (%d %d %d).\n", String, *i, *j, *Depth);
- X Cafard (Err);
- X }
- X} /* StringToPosition */
- X
- X
- XWriteBoard (GameName, Game)
- X char *GameName;
- X GameType *Game;
- X{
- XFILE *F;
- Xint i, j, k, Count, MoveNum, NumRows;
- XMoveType *m;
- Xchar String [80];
- Xchar Moves [MaxMoves] [2];
- X sprintf (String, "%s.brd", GameName);
- X if (NULL == (F= fopen (String, "w", 0))) return 1;
- X if (Game->Handicap != 0) fprintf (F, "Handicap: %d.\n", Game->Handicap);
- X for (i= 0, Count= 0; i < Game->Grid; i++)
- X for (j= 0; j < Game->Grid; j++)
- X if (Game->InitialBoard [i] [j] != Empty) Count++;
- X if (Count > 0) {
- X fprintf (F, "Black at: ");
- X for (i= 0; i < Game->Grid; i++)
- X for (j= 0; j < Game->Grid; j++) {
- X if (Game->InitialBoard [i] [j] == Black) {
- X fprintf (F, " %s", PositionToString (i, j, String, 0));
- X } /*if*/
- X }
- X fprintf (F, ".\nWhite at: ");
- X for (i= 0; i < Game->Grid; i++)
- X for (j= 0; j < Game->Grid; j++) {
- X if (Game->InitialBoard [i] [j] == White) {
- X fprintf (F, " %s", PositionToString (i, j, String, 0));
- X } /*if*/
- X }
- X fprintf (F, ".\n");
- X }
- X MoveNum= 0;
- X m= Game->MoveList;
- X fprintf (F, " A B C D E F G H J K L M N O P Q R S T");
- X if ((Game->FirstPlayer == White) && (m != NULL)) {
- X fprintf (F, "\t 1:\t\t%s.\n", PositionToString (m->i, m->j, String,0));
- X MoveNum= 1;
- X m= m->Next;
- X } else {
- X fprintf (F, "\n");
- X }
- X for (j= Game->Grid - 1; j >= 0; j--) {
- X fprintf (F, "%2d", j + 1);
- X for (i= 0; i < Game->Grid; i++) {
- X switch (Game->Board [i] [j]) {
- X case Empty:
- X if (((i == 3) || (i == (Game->Grid-4)) || (i == (Game->Grid/2)))
- X && ((j == 3) || (j == (Game->Grid-4)) || (j == (Game->Grid/2))))
- X fprintf (F, " +");
- X else fprintf (F, " .");
- X break;
- X case Black: fprintf (F, " *"); break;
- X case White: fprintf (F, " O"); break;
- X }
- X }
- X fprintf (F, " %2d", j + 1);
- X if (m == NULL) fprintf (F, "\n");
- X else if (MoveNum < Game->MoveNum) {
- X fprintf (F, "\t%3d:\t%s", MoveNum+1
- X , PositionToString (m->i, m->j, String, 0));
- X m= m->Next;
- X if ((++MoveNum < Game->MoveNum) && (m != NULL)) {
- X fprintf (F, "\t%s.\n", PositionToString (m->i, m->j, String,0));
- X m= m->Next;
- X } else {
- X fprintf (F, "\n");
- X }
- X MoveNum++;
- X } else {
- X fprintf (F, "\n");
- X }
- X }
- X fprintf (F, " A B C D E F G H J K L M N O P Q R S T");
- X if (m == NULL) fprintf (F, "\n");
- X else if (MoveNum < Game->MoveNum) {
- X fprintf (F, "\t%3d:\t%s", MoveNum+1
- X , PositionToString (m->i, m->j, String, 0));
- X m= m->Next;
- X if ((++MoveNum < Game->MoveNum) && (m != NULL))
- X fprintf (F, "\t%s.\n\n", PositionToString (m->i, m->j, String, 0));
- X else {
- X fprintf (F, "\n");
- X }
- X if (m != NULL) {
- X m= m->Next;
- X MoveNum++;
- X }
- X }
- X for (; MoveNum < Game->MoveNum; MoveNum++) {
- X if (m == NULL) break;
- X Moves [MoveNum-40] [0]= (char) m->i;
- X Moves [MoveNum-40] [1]= (char) m->j;
- X m= m->Next;
- X }
- X NumRows= 1 + ((Game->MoveNum - 41) / 6);
- X for (i= 0, j= NumRows * 2, k= NumRows * 4; i < NumRows - 1; i++) {
- X fprintf (F, "%3d: %3s %3s\t\t%3d: %3s %3s\t\t%3d: %3s %3s\n",
- X i + 41,
- X PositionToString (Moves [i] [0], Moves [i] [1], String, 0),
- X PositionToString (Moves [i+1] [0], Moves [i+1] [1], String, 0),
- X j + 41,
- X PositionToString (Moves [j] [0], Moves [j] [1], String, 0),
- X PositionToString (Moves [j+1] [0], Moves [j+1] [1], String, 0),
- X k + 41,
- X PositionToString (Moves [k] [0], Moves [k] [1], String, 0),
- X PositionToString (Moves [k+1] [0], Moves [k+1] [1], String, 0));
- X }
- X fprintf ("\n");
- X fprintf (F, "\nWhite stones captured: %d. Black: %d.\n"
- X , Game->Prisoners [White], Game->Prisoners [Black]);
- X fclose (F);
- X return 0;
- X} /* WriteBoard */
- X
- X
- XWriteGame (GameName, Game)
- X char *GameName;
- X GameType *Game;
- X{
- XFILE *F;
- Xint i, j;
- Xchar String [80];
- XMoveType *m;
- X if (NULL == (F= fopen (GameName, "w", 0))) return 1;
- X if (Game->Note) {
- X fprintf (F, "/*%s*/\n", Game->Note);
- X }
- X fprintf (F, "%d\n", Game->Grid);
- X fprintf (F, "%d\n", Game->Handicap); /* Handicap */
- X if (Game->Handicap == 0) {
- X for (i= 0; i < Game->Grid; i++)
- X for (j= 0; j < Game->Grid; j++) {
- X if (Game->InitialBoard [i] [j] == Black) {
- X fprintf (F, " %s", PositionToString (i, j, String, 0));
- X } /*if*/
- X }
- X fprintf (F, " .\n");
- X for (i= 0; i < Game->Grid; i++)
- X for (j= 0; j < Game->Grid; j++) {
- X if (Game->InitialBoard [i] [j] == White) {
- X fprintf (F, " %s", PositionToString (i, j, String, 0));
- X } /*if*/
- X }
- X fprintf (F, " .\n");
- X } /* else Initial board position automatic. */
- X if (Game->FirstPlayer == Black) fprintf (F, "Black\n");
- X else fprintf (F, "White\n");
- X for (m= Game->MoveList; m != NULL; m= m->AltNext) {
- X WriteBranch (m, 1, F);
- X if (m->AltNext == Game->MoveList) break;
- X }
- X fprintf (F, "\n");
- X fclose (F);
- X return 0;
- X} /* WriteGame */
- X
- X
- XWriteBranch (m, Depth, F)
- X MoveType *m;
- X int Depth;
- X FILE *F;
- X{
- XMoveType *m1;
- Xchar String [20];
- X fprintf (F, "%s\n", PositionToString (m->i, m->j, String, Depth));
- X if ((m->Label [0] != ' ') && (m->Label [0] != '\0'))
- X fprintf (F, "|%s\n", m->Label);
- X if (m->Note) fprintf (F, "/*%s*/\n", m->Note);
- X if (m->Next != NULL)
- X for (m1= m->Next, Depth++; m1 != NULL; m1= m1->AltNext) {
- X WriteBranch (m1, Depth, F);
- X if (m1->AltNext == m->Next) break;
- X }
- X} /* WriteBranch */
- X
- X
- XZeroGame (Game, ShouldPaint)
- X GameType *Game;
- X Panel_setting ShouldPaint;
- X/* Initializes a game by clearing boards and data structures. */
- X{
- Xint i, j;
- X if (Game->Note) free (Game->Note);
- X for (i= 0; i < MaxGrid; i++)
- X for (j= 0; j < MaxGrid; j++) {
- X Game->InitialBoard [i] [j]= Empty;
- X Game->Groups [i] [j]= NULL;
- X }
- X if (Game->MoveList != NULL) FreeMoves (Game->MoveList);
- X Game->MoveList= Game->CurrMove= NULL;
- X Game->NumMoves= Game->MoveNum= 0;
- X panel_set (CurrMoveSlider, PANEL_VALUE, Game->MoveNum
- X , PANEL_PAINT, ShouldPaint, 0);
- X if (Game->Handicap == 0) SetFirst (Game, Black, ShouldPaint);
- X else SetFirst (Game, White, ShouldPaint);
- X Game->Placing= 0;
- X Game->Grid= 19; /* Traditional. */
- X Game->Prisoners [0]= Game->Prisoners [1]= 0;
- X} /* ZeroGame */
- END_OF_FILE
- if test 16823 -ne `wc -c <'goservice.c'`; then
- echo shar: \"'goservice.c'\" unpacked with wrong size!
- fi
- # end of 'goservice.c'
- fi
- if test -f 'masterofgo' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'masterofgo'\"
- else
- echo shar: Extracting \"'masterofgo'\" \(1699 characters\)
- sed "s/^X//" >'masterofgo' <<'END_OF_FILE'
- X19
- X0
- X .
- X .
- XBlack
- X1.R16
- X2.R4
- X3.D3
- X4.C5
- X5.E4
- X6.P16
- X7.P17
- X8.O17
- X9.Q17
- X10.N16
- X11.O15
- X12.P15
- X13.O18
- X14.O14
- X15.N18
- X16.O3
- X17.Q14
- X18.C15
- X19.C17
- X20.E16
- X21.E17
- X22.F17
- X23.F16
- X24.G16
- X25.F15
- X26.E15
- X27.G17
- X28.F18
- X29.E18
- X30.G18
- X31.F14
- X32.H17
- X33.E14
- X34.C16
- X35.B17
- X36.C12
- X37.D11
- X38.C11
- X39.D10
- X40.C10
- X41.D9
- X42.C9
- X43.D8
- X44.C7
- X45.D6
- X46.C6
- X47.D7
- X48.K4
- X49.K17
- X50.K15
- X51.J15
- X52.K16
- X53.J16
- X54.J17
- X55.L17
- X56.J14
- X57.H15
- X58.K14
- X59.H14
- X60.K18
- X61.L18
- X62.J19
- X63.O5
- X64.O4
- X65.M5
- X66.M4
- X67.M15
- X68.M14
- X69.L14
- X70.N15
- X71.M13
- X72.N14
- X73.L16
- X74.L13
- X75.L15
- X76.M12
- X77.K13
- X78.N13
- X79.Q12
- X80.K12
- X81.J13
- X82.R8
- X83.R10
- X84.S10
- X85.S11
- X86.P8
- X87.S9
- X88.L5
- X89.H3
- X90.H4
- X91.G4
- X92.G3
- X93.H2
- X94.J3
- X95.H5
- X96.J4
- X97.G2
- X98.L8
- X99.L11
- X100.L12
- X101.S7
- X102.S8
- X103.T8
- X104.R7
- X105.S6
- X106.R5
- X107.B4
- X108.D13
- X109.B16
- X110.B15
- X111.D17
- X112.G5
- X113.F3
- X114.H6
- X115.P10
- X116.O10
- X117.O11
- X118.N10
- X119.P9
- X120.O9
- X121.H16
- X122.H18
- X123.R6
- X124.Q6
- X125.T4
- X126.S3
- X127.N11
- X128.M11
- X129.O8
- X130.S5
- X131.O7
- X132.P7
- X133.M10
- X134.N9
- X135.M9
- X136.N8
- X137.M8
- X138.N7
- X139.M7
- X140.N6
- X141.M6
- X142.N5
- X143.K10
- X144.J2
- X145.T5
- X146.T3
- X147.T7
- X148.B5
- X149.B3
- X150.J9
- X151.J10
- X152.H10
- X153.J11
- X154.K9
- X155.H8
- X156.H9
- X157.F5
- X158.G6
- X159.G8
- X160.J8
- X161.C8
- X162.B8
- X163.O12
- X164.N12
- X165.R9
- X166.P13
- X167.Q13
- X168.E19
- X169.D19
- X170.F19
- X171.B19
- X172.H7
- X173.J1
- X174.K1
- X175.H1
- X176.K2
- X177.A15
- X178.A14
- X179.A16
- X180.C14
- X181.Q8
- X182.Q7
- X183.Q9
- X184.O6
- X185.F7
- X186.F6
- X187.E6
- X188.A5
- X189.L7
- X190.K7
- X191.F9
- X192.D5
- X193.E5
- X194.H11
- X195.J12
- X196.F10
- X197.D16
- X198.E10
- X199.E9
- X200.D15
- X201.B13
- X202.B14
- X203.C13
- X204.B12
- X205.D14
- X206.A13
- X207.D12
- X208.F12
- X209.E12
- X210.C13
- X211.F11
- X212.G11
- X213.E11
- X214.L9
- X215.L10
- X216.G13
- X217.L19
- X218.K19
- X219.L6
- X220.K6
- X221.G10
- X222.G9
- X223.F10
- X224.G7
- X225.F8
- X226.A4
- X227.A3
- X228.C4
- X229.C3
- X230.P12
- X231.P11
- X232.Q15
- X233.R15
- X234.O16
- X235.T9
- X236.M17
- X237.M18
- X
- END_OF_FILE
- if test 1699 -ne `wc -c <'masterofgo'`; then
- echo shar: \"'masterofgo'\" unpacked with wrong size!
- fi
- # end of 'masterofgo'
- fi
- if test -f 'masterofgo.brd' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'masterofgo.brd'\"
- else
- echo shar: Extracting \"'masterofgo.brd'\" \(1 character\)
- sed "s/^X//" >'masterofgo.brd' <<'END_OF_FILE'
- X
- END_OF_FILE
- if test 1 -ne `wc -c <'masterofgo.brd'`; then
- echo shar: \"'masterofgo.brd'\" unpacked with wrong size!
- fi
- # end of 'masterofgo.brd'
- fi
- echo shar: End of shell archive.
- exit 0
-